After failing repeatedly in my quest to get my flask application to run on Apache using mod_wsgi
I decided to try running the hello world example. Here is what I have -
Directory Structure (I changed the apache default /var/www
to ~/public_html
)
- public_html
- wsgi-scripts
- test_wsgi.wsgi
- test_wsgi
- test_wsgi.wsgi
test_wsgi.wsgi file
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
VirtualHost Configuration file (called testwsgi) - This resides in /etc/apache2/sites-enabled/
<VirtualHost *:80>
DocumentRoot ~/public_html/test_wsgi
<Directory ~/public_html/test_wsgi>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /wsgi ~/public_html/wsgi-scripts/test_wsgi.wsgi
<Directory ~/public_html/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
When I try going to localhost/wsgi
on the browser I get a 404 Not Found error. What am I doing wrong? This is the first time I'm trying to deploy an app on a production server. Until now I took the easy way of using Google App Engine. I cant proceed to deploy my flask app until this is up and running. Thanks a lot!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…