简体   繁体   中英

Pythonanywhere error when accessing the homepage

I get the following error when I access my homepage (on Pythonanywhere). I believe all the settings are correct in the WSGI file. ImportError: No module named 'myproject' - even though the module is there. Is this something I have to define somewhere?

The error is as follows:

2020-02-19 02:25:26,696: Error running WSGI application
2020-02-19 02:25:26,697: ImportError: No module named 'myproject'
2020-02-19 02:25:26,697:   File "/var/www/user1_pythonanywhere_com_wsgi.py", line 16, in <module>
2020-02-19 02:25:26,697:     application = get_wsgi_application()
2020-02-19 02:25:26,697: 
2020-02-19 02:25:26,697:   File "/home/user1/.virtualenvs/mysite-virtualenv/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2020-02-19 02:25:26,697:     django.setup(set_prefix=False)
2020-02-19 02:25:26,697: 
2020-02-19 02:25:26,697:   File "/home/user1/.virtualenvs/mysite-virtualenv/lib/python3.5/site-packages/django/__init__.py", line 19, in setup
2020-02-19 02:25:26,698:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2020-02-19 02:25:26,698: 
2020-02-19 02:25:26,698:   File "/home/user1/.virtualenvs/mysite-virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 79, in __getattr__
2020-02-19 02:25:26,698:     self._setup(name)
2020-02-19 02:25:26,698: 
2020-02-19 02:25:26,698:   File "/home//.virtualenvs/mysite-virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 66, in _setup
2020-02-19 02:25:26,698:     self._wrapped = Settings(settings_module)
2020-02-19 02:25:26,698: 
2020-02-19 02:25:26,699:   File "/home/user1/.virtualenvs/mysite-virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 157, in __init__
2020-02-19 02:25:26,699:     mod = importlib.import_module(self.SETTINGS_MODULE)

在 PythonAnywhere 上,就在日志中出现异常之后,有一个指向帮助页面的链接,可引导您调试 Web 应用程序中的导入错误。

I figured it out. It was an issue with the path. I dropped the app and re-created it from scratch. Worked like a charm!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM