尝试执行manage.py runserver 0.0.0.0:8000
:
[31/Mar/2019 08:19:53] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/root/venv/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/root/venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/root/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 177, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/root/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 222, in handle_uncaught_exception
if resolver.urlconf_module is None:
File "/root/venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 342, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/root/venv/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named py
操作系统:Ubuntu 14.04
Python:2.7
Django:1.4
使用pip install py
安装它没有帮助。
我的bashrc中也没有别名,如下所示:"import py" > No module named py
这是什么原因?
答案 0 :(得分:0)
由于@Alasdair的回答,我检查了配置,ROOT_URLCONF
确实是导致错误的原因。它指向mymodule.urls.py
,而正确的值为mymodule.urls
更改此设置可消除错误。