[Flask] app.route not found serving applicaiton w/Apache & mod_wsgi
ZDunlap at ap.org
Mon Oct 19 18:10:33 CEST 2015
Answers to your questions:
1. Yes, I’m using Apache to rewrite URLs.
2. I’m fairly sure I configured Apache correctly, I’m using Apache via WAMP on a Windows server (unfortunately my hands are tied to using Windows for now due to my company)
Apache configuration looks like this, note that using: Order deny,allow & Allow from all gave me a, you do not have access error so I changed that as you’ll see below (maybe this is also wrong?):
WSGIScriptAlias /friendly-url d:/zachs_app/zachs_excellent_wsgi_file
Require all granted
If you need more code let me know and I can provide a more complete example. The only things missing from the Python below though are the imports, calls to S3 using the Boto library and calls using the requests library.
Thanks very much for taking a look.
From: David Baumgold [mailto:david at davidbaumgold.com]
Sent: Monday, October 19, 2015 11:37 AM
To: flask at python.org; Dunlap, Zachariah
Subject: Re: [Flask] app.route not found serving applicaiton w/Apache & mod_wsgi
You say you’ve configured Apache to serve the application with a friendly URL. Does that mean that Apache is rewriting URLs for you? It could be that when you direct the user to /generate_urls on your application, Apache is rewriting it somehow so that Flask doesn’t see that it matches one of the URL routes you’ve set up. Without seeing more of your code, I can’t tell.
Also, have you configured Apache properly as per the documentation? http://flask.pocoo.org/docs/0.10/deploying/mod_wsgi/
From: Dunlap, Zachariah <zdunlap at ap.org><mailto:zdunlap at ap.org>
Reply: Dunlap, Zachariah <zdunlap at ap.org><mailto:zdunlap at ap.org>
Date: October 19, 2015 at 11:25:56 AM
To: flask at python.org<mailto:flask at python.org> <flask at python.org><mailto:flask at python.org>
Subject: [Flask] app.route not found serving applicaiton w/Apache & mod_wsgi
Hello Flask mailing list,
I’m new to Flask so I have no doubt many of you will have great suggestions on how to fix my issue.
The app is basically structured like this (edited to keep this message as short as possible):
@app.route('/generate_urls', methods = ['GET', 'POST'])
BUNCH OF CODE HERE (REMOVED FOR BREVITY)
if __name__ == '__main__':
My folder structure for the app looks like this:
When I serve the app using the dev method, everything works great with no issues.
Now I’m working on using Apache and mod_wsgi to serve the app with a friendly URL and the homepage is served without issue once I’ve configured everything but when I attempt to use the form to create the links, I get an error from Apache that says:
The requested URL /generate_urls was not found on this server.
This leads me to believe it doesn’t know what to do with the @app.route() call.
I’m sure I’m missing something and may need to approach this differently, but I haven’t had much luck figuring that out on my own yet.
Any help with this would be greatly appreciated.
The information contained in this communication is intended for the use
of the designated recipients named above. If the reader of this
communication is not the intended recipient, you are hereby notified
that you have received this communication in error, and that any review,
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, please
notify The Associated Press immediately by telephone at +1-212-621-1898
and delete this email. Thank you.
Flask mailing list
Flask at python.org<mailto:Flask at python.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Flask