Forums

Flask: ImportError: cannot import name 'app'.

Hi all,

I get the following error when I try to run my Flask server:

ImportError: cannot import name 'app'

My first reaction when seeing the stack trace was to think that it was complaining about a circular import. But it works fine on my machine, so I don't understand why it would be behaving differently on PythonAnywhere.

Anyone have any tips?

Update: Problem solved, I needed to figure out how to get Flask to work with multiple files without having circular imports.

Great. Glad you solved it.

ImportError: cannot import name 'app' from 'flask_app' I get this error and I can't figure out the problem

Is there a name app defined in the flask_app?

Where are you getting that error?

Could we look into your code? (we can do it but we ask first)

Also, take a look at https://help.pythonanywhere.com/pages/DebuggingImportError/