简体   繁体   English

访问主页时出现Pythonanywhere错误

[英]Pythonanywhere error when accessing the homepage

I get the following error when I access my homepage (on Pythonanywhere).当我访问我的主页(在 Pythonanywhere 上)时出现以下错误。 I believe all the settings are correct in the WSGI file.我相信 WSGI 文件中的所有设置都是正确的。 ImportError: No module named 'myproject' - even though the module is there.导入错误:没有名为“myproject”的模块 - 即使该模块在那里。 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!像魅力一样工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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