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

David Baumgold david at davidbaumgold.com
Mon Oct 19 17:36:35 CEST 2015


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>
Reply: Dunlap, Zachariah <zdunlap at ap.org>
Date: October 19, 2015 at 11:25:56 AM
To: flask at python.org <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():

  BUNCH OF CODE HERE (REMOVED FOR BREVITY)

  return RETURN_STUFF

 

@app.route('/')

def index():

  return render_template('index.html')

 

if __name__ == '__main__':

  app.run(host='0.0.0.0', port=1234)

 

My folder structure for the app looks like this:

 

app folder

--app_name.py

--static (folder)

----css (folder)

------css_file.css

----js (folder)

------js_file.js

 

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.

 

Thanks,


Zach

 

 

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.
[IP_US_DISC]


msk dccc60c6d2c3a6438f0cf467d9a4938

_______________________________________________  
Flask mailing list  
Flask at python.org  
https://mail.python.org/mailman/listinfo/flask  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20151019/cf0862c7/attachment-0001.html>


More information about the Flask mailing list