Apache WSGI + Flask, get 404 error
I tried to set up a hello world Flask app on Apache, following its document.
What I got is,
% cat /etc/apache2/sites-available/flask.conf
<VirtualHost *:80> WSGIScriptAlias /py /var/www/py/wsgi.py <Directory /var/www/py> Require all granted </Directory>
</VirtualHost>
% cat /var/www/py/wsgi.py
from app import app as application
% cat /var/www/py/app.py
from Flask import flask
app = Flask(__name__)
@app.route('/')
def hello(): return 'hello wsgi'I've a2ensite flask and reload Apache. But I got a 404 error from Apache when I tried to visit localhost/py
% a2query -m wsgi
wsgi (enabled by maintainer script)
% apache2 -v
Server version: Apache/2.4.12 (Ubuntu)
Server built: Jul 24 2015 15:59:00
% pip show flask
---
Metadata-Version: 1.1
Name: Flask
Version: 0.10.1 1 Answer
OK so it seems that somehow flask.conf is not working on its own. I just append flask.conf to the default configure 000-default.conf and it works happily. And I definitely a2ensite flasked. Really weird.