Created
April 4, 2018 07:41
-
-
Save lynas/ddd36df10f27c45bfd5db41f3a32089a to your computer and use it in GitHub Desktop.
flask application running on apache server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hostname -I | |
apt install apache2 python3 python3-pip virtualenv vim libapache2-mod-wsgi python-pip | |
pip3 install flask | |
pip install flask | |
/etc/init.d/apache2 restart | |
vim /etc/apache2/sites-available/flask.conf | |
<VirtualHost *:80> | |
serverName flaskapp.com | |
WSGIScriptAlias / /var/www/flask/flask.wsgi | |
<Directory /var/www/flask> | |
Order allow,deny | |
Allow from all | |
</Directory> | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/error.log combined | |
</VirtualHost> | |
vim /var/www/flask/init.py | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def index(): | |
return "hello world" | |
if __name__ == "__main__": | |
app.run() | |
vim /var/www/flask/flask.wsgi | |
import sys | |
sys.path.insert(0, "/var/www/flask/") | |
from init import app as application | |
a2ensite flask.conf | |
a2dissite 000-default.conf | |
service apache2 reload | |
tail -1000 /var/log/apache2/error.log | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment