Python Flask getting 404 Not Found Error
I'm having the same problem.
I'm doing some experimental CORS tests between backbone and Flask as an endpoint in a different url
Are you using SERVER_NAME in your Config object or when you use the app.run ?
I put the SERVER_NAME but did not specify the port,
class Config(object): DEBUG = True TESTING = True STATIC_FOLDER = STATIC_FOLDER STATIC_URL = STATIC_URL NAVIGATION_JS = '/static/js/navigation.js' SESSION_COOKIE_SECURE = True REDIS_HOST_SESSION = 'localhost' REDIS_PORT_SESSION = 6379 REDIS_DB_SESSION = 2 REDIS_HOST = 'localhost' REDIS_PORT = 6379 REDIS_DB = 3 SERVER_NAME = 'api.jvazquez.com.ar'
Server name doesn't has the port
I also was getting 404 for any of the routes I had defined (if you are interested, I'm using blueprints)
When I send a request to my flask app using curl, I was getting 404, here is the outputI was getting 404 for all of the blueprints that I had defined
jvazquez@aldebaran:~$ curl -i http://api.jvazquez.com.ar:5000/alive/HTTP/1.0 404 NOT FOUNDContent-Type: text/htmlContent-Length: 233 Set-Cookie: session=94c2c120-34c0-4a00-b094-7b5623d438ff; Domain=.api.jvazquez.com.ar; HttpOnly; Path=/Server: Werkzeug/0.9.4 Python/2.7.3Date: Wed, 25 Dec 2013 11:21:16 GMT
So, check if you have defined the config variable SERVER_NAME and it has the port
For whatever reason I encountered this when I set the SERVER_NAME to 127.0.0.1
instead of localhost
. I don't know why that was important with my setup, but after changing it to localhost
everything started working again.