Flask blog app with MongoDB on Ubuntu 14 : Part 2 (Local Apache WSGI)
bogotobogo.com site search:
Note
Continued from Flask "blog app" with MongoDB.
In this page, we'll first serve the Flask blog app using local Apache on Ubuntu 14. Then, we're going to deploy it to CentOS 7 VPS.
WSGI
/var/www/FlaskApp/Blog/flaskapp.wsgi:
#!/usr/bin/python import sys import logging logging.basicConfig(stream=sys.stderr) sys.path.insert(0,"/var/www/FlaskApp/") from Blog import app as application application.secret_key = 'Add your secret key'
Apache config
/etc/apache2/sites-available/flaskblogsite.com.conf:
<VirtualHost *:80> ServerAlias flaskblogsite.com ServerName www.flaskblogsite.com ServerAdmin admin@flaskblogsite.com WSGIDaemonProcess Blog user=www-data group=www-data threads=5 python-path=/var/www/FlaskApp/Blog:/var/www/FlaskApp/Blog/venv/lib/python2.7/site-packages WSGIScriptAlias / /var/www/FlaskApp/Blog/flaskapp.wsgi <Directory /var/www/FlaskApp/Blog/> WSGIProcessGroup Blog WSGIApplicationGroup %{GLOBAL} Order allow,deny Allow from all </Directory> Alias /static /var/www/FlaskApp/Blog/static <Directory /var/www/FlaskApp/Blog/static/> Order allow,deny Allow from all </Directory> ErrorLog /var/www/flaskblogsite.com/logs/error.log LogLevel warn CustomLog /var/www/flaskblogsite.com/logs/access.log combined </VirtualHost>
/etc/hosts
/etc/hosts:
127.0.0.1 flaskblogsite.com
Running the Flask blog app run on Apache
Here is the initial screen shot from the Apache run:
After login, we get the following page:
Deploy to production
Visit Flask "Blog App" with MongoDB on CentOS 7 - Part 3 (Production Apache WSGI ).
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization