Main folder structure
pycache/
data/
pages/
run.py
files in pages/, index.py, page_1.py, page_2.py,.........
code - run.py
import pages.index as index
if __name__ == '__main__':
index.app.run_server(debug=True)
Code in /var/www/test_pythonanywhere_com_wsgi.py
# This file contains the WSGI configuration required to serve up your
# web application at http://<your-username>.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# The below has been auto-generated for your Flask project
import sys
# add your project directory to the sys.path
project_home = '/home/test/mysite/'
if project_home not in sys.path:
sys.path = [project_home] + sys.path
# import flask app but need to call it "application" for WSGI to work
from weber_dashboard import run
application = run.server
Error message:
2022-04-29 15:07:21,843: Error running WSGI application 2022-04-29 15:07:21,846: ModuleNotFoundError: No module named 'pages' 2022-04-29 15:07:21,847: File "/var/www/lataigmbh_pythonanywhere_com_wsgi.py", line 16, in <module> 2022-04-29 15:07:21,847: from weber_dashboard import run 2022-04-29 15:07:21,847: 2022-04-29 15:07:21,847: File "/home/lataigmbh/mysite/weber_dashboard/run.py", line 1, in <module> 2022-04-29 15:07:21,847: import pages.index as index 2022-04-29 15:07:21,847: ******* 2022-04-29 15:07:21,848: If you're seeing an import error and don't know why, 2022-04-29 15:07:21,848: we have a dedicated help page to help you debug: 2022-04-29 15:07:21,848: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2022-04-29 15:07:21,848: *******
run.py runs perfectly fine in the bash console