Forums

I am getting ImportError

Hi, I am getting Error running WSGI application ImportError: cannot import name 'app' from 'mysite' My file structure is as follows: mysite-->main.py, init.py, others.py, templates-->html stuff

init.py contains app=Flask(name)

main.py contains main = Blueprint('main', name )(not sure if this is relevant)

My WSGI config is set as -->from mysite import app as application

My working directory is set as home/username and I have a virtual environment enabled.

I have looked into the PythonAnywhere import help page and flask setup page but am still unable to solve the problem. Please help!

The important thing for imports is what you have added to your sys.path in your WSGI file. All of your imports will be realative to that. So, if you have your mysite directory added to sys.path in your WSGI file, you will need to use import app to import your application.