Forums

404 error when trying to access resource

Hello, I'm trying to set up a Flask environment here, and getting a 404 error

My app is a single file https://github.com/juanmougan/juan-status/blob/master/api.py

And this is my WSGI configuration file. I commented out the autogenerated part, because that wouldn't work as well.

# This file contains the WSGI configuration required to serve up your
# web application at http://<your-username>.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# The below has been auto-generated for your Flask project

import sys

# add your project directory to the sys.path
#project_home = u'/home/juanmougan/juan-status'
#if project_home not in sys.path:
#    sys.path = [project_home] + sys.path

# import flask app but need to call it "application" for WSGI to work
#from api import app as application  # noqa

sys.path.append('/home/juanmougan/juan-status')
from api import app as application

If I go to the root url http://juanmougan.pythonanywhere.com/

I see a welcome message

But if I go to http://juanmougan.pythonanywhere.com/projects

I see a 404 error

Any ideas about this? Thanks in advance!

Your web app is still serving the default flask app that PythonAnywhere provides, so I don't think you're running the code that you think you're running. If you have not reloaded your web app recently, reload it and if you have, check that the code that you're importing is, in fact, what you expect it to be.