Hi, I already managed to get rid of all errors by searching the forum. But this one is kinda killing me.
In my file run.py
which usually is peoples app.py
I am initializing Flask-Mail by mail = Mail(app)
and in /home/appboost1/mysite/app/home/routes.py
I am importing it by from run import mail, app
which is in the path /home/appboost1/mysite/app/run.py
.
On my local machine it is working.
But the server logs show following error, any idea/help appreciated!
2021-01-21 00:04:40,027: Error running WSGI application
2021-01-21 00:04:40,037: ImportError: cannot import name 'mail' from 'run' (/home/appboost1/mysite/run.py)
2021-01-21 00:04:40,037: File "/var/www/appboost1_pythonanywhere_com_wsgi.py", line 16, in <module>
2021-01-21 00:04:40,037: from run import app as application # noqa
2021-01-21 00:04:40,037:
2021-01-21 00:04:40,037: File "/home/appboost1/mysite/run.py", line 28, in <module>
2021-01-21 00:04:40,037: app = create_app(config_mode)
2021-01-21 00:04:40,037:
2021-01-21 00:04:40,038: File "/home/appboost1/mysite/app/__init__.py", line 81, in create_app
2021-01-21 00:04:40,038: register_blueprints(app)
2021-01-21 00:04:40,038:
2021-01-21 00:04:40,038: File "/home/appboost1/mysite/app/__init__.py", line 23, in register_blueprints
2021-01-21 00:04:40,038: module = import_module('app.{}.routes'.format(module_name))
2021-01-21 00:04:40,038:
2021-01-21 00:04:40,038: File "/home/appboost1/mysite/app/base/routes.py", line 14, in <module>
2021-01-21 00:04:40,038: from app.home.routes import send_mail_async
2021-01-21 00:04:40,038:
2021-01-21 00:04:40,039: File "/home/appboost1/mysite/app/home/routes.py", line 26, in <module>
2021-01-21 00:04:40,039: from run import mail, app
2021-01-21 00:04:40,039: ***************************************************
2021-01-21 00:04:40,039: If you're seeing an import error and don't know why,
2021-01-21 00:04:40,039: we have a dedicated help page to help you debug:
2021-01-21 00:04:40,039: https://help.pythonanywhere.com/pages/DebuggingImportError/
2021-01-21 00:04:40,039: ***************************************************
[formatted by admin]