[Flask] app.route not found serving applicaiton w/Apache & mod_wsgi

Dunlap, Zachariah ZDunlap at ap.org
Mon Oct 19 18:13:47 CEST 2015

Sorry forgot to include what the wsgi file looks like:

import sys
from zach_app import app as application

From: Flask [mailto:flask-bounces+zdunlap=ap.org at python.org] On Behalf Of Dunlap, Zachariah
Sent: Monday, October 19, 2015 12:11 PM
To: David Baumgold; flask at python.org
Subject: Re: [Flask] app.route not found serving applicaiton w/Apache & mod_wsgi

Thanks David,

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?):

<VirtualHost *>
        ServerName localhost
        WSGIScriptAlias /friendly-url d:/zachs_app/zachs_excellent_wsgi_file
        <Directory d:/zachs_app>
                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<mailto: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/

David Baumgold

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.

I have a simple web app which responds to an HTML form containing some selections that return links for Amazon S3 folders. I’ve used JavaScript to return the results on the same page to make it an easier experience for users (this is an internal only app, it won’t go out to the live web).

The app is basically structured like this (edited to keep this message as short as possible):

@app.route('/generate_urls', methods = ['GET', 'POST'])
def generate_urls():

def index():
  return render_template('index.html')

if __name__ == '__main__':
  app.run(host='', port=1234)

My folder structure for the app looks like this:

app folder
--static (folder)
----css (folder)
----js (folder)

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:

Not Found
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.

msk dccc60c6d2c3a6438f0cf467d9a4938
Flask mailing list
Flask at python.org<mailto:Flask at python.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20151019/5ab763c0/attachment-0001.html>

More information about the Flask mailing list