Forums

flask Error running WSGI application ImportError: cannot import name 'app' from 'site'

hi there. it's my first time deploying a Flask app. Can you help me? I can't understed. Error running WSGI application ImportError: cannot import name 'app' from 'site' (/home/muratgunes/.virtualenvs/venv/lib/python3.8/site.py) File "/var/www/www_eterapidestek_com_wsgi.py", line 84, in <module> from site import app as application

wsgi.py import sys path = '/home/muratgunes/psikolog-sitesi' if path not in sys.path: sys.path.append(path) from site import app as application !site.app as application imported but unused

You're using a module name (site) that is already in use by Python. So when you import from site, you're not importing from your module, you're importing from the Python version of the module. Try renaming the file where you have your web app and changing the import in your wsgi file to match.

Thanks glenn. problem is solved :)

Great, glad we could help!

Hi, am facing the same issue because I am running my code from onedrive, which ends up two having different addresses from different pcs (due to different username). how can I solve this?

Are you sure it's the same issue? The address of a machine has no bearing on whether you can import a module or not.