rudehlabya
rudehlabya

Reputation: 119

WSGI Configuration failing on pythonanywhere due to module not being found

I am currently trying to deploy my python/flask app to pythonanywhere, but am currently stuck on the WSGI Configuration step. Here is my code:

import sys
#
## The "/home/azanbade" below specifies your home
## directory -- the rest should be the directory you uploaded your Flask
## code to underneath the home directory.  So if you just ran
## "git clone [email protected]/myusername/myproject.git"
## ...or uploaded files to the directory "myproject", then you should
## specify "/home/azanbade/myproject"
path = '/home/azanbade/path/to/Word-finder'
if path not in sys.path:
    sys.path.append(path)
#
from app import app as application  # noqa
#
# NB -- many Flask guides suggest you use a file called run.py; that's
# not necessary on PythonAnywhere.  And you should make sure your code
# does *not* invoke the flask development server with app.run(), as it
# will prevent your wsgi file from working.

Everything looks fine to me until I try running the app. I continue to get this error message, "ModuleNotFoundError: No module named 'app'"

Here is a photo of my root directory as well as server(which is my application's main file): Root Directory, Server

Is my configuration formatted correctly?

Upvotes: 1

Views: 110

Answers (1)

Grey Li
Grey Li

Reputation: 12762

You have to make sure the path points to the right path to your application.

path = '/home/<your-username>/<path-to-your-app-folder>'

Upvotes: 1

Related Questions