我在 Django 1.5.1 上运行一个示例站点,但是在创建名为“website”的 Django 应用程序时出现 ImportError。这是我的应用程序层次结构。
TrackLeech
-- __init__.py
-- manage.py
TrackLeech
-- __init__.py
-- setting.py
-- urls.py
-- wsgi.py
website
-- __init__.py
-- models.py
-- tests.py
-- views.py
templates
-- index.html
现在,当我运行命令时,服务器在端口 8000 处启动良好,但 localhost:8000 页面显示 ImportError
$ python manage.py runserver
Validating models...
0 errors found
July 24, 2013 - 13:29:03
Django version 1.5.1, using settings 'TrackLeech.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Internal Server Error: /
Traceback (most recent call last):
File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/handlers/base.py", line 103, in get_response
resolver_match = resolver.resolve(request.path_info)
File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/urlresolvers.py", line 321, in resolve
sub_match = pattern.resolve(new_path)
File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/urlresolvers.py", line 223, in resolve
return ResolverMatch(self.callback, args, kwargs, self.name)
File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/urlresolvers.py", line 230, in callback
self._callback = get_callable(self._callback_str)
File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/utils/functional.py", line 29, in wrapper
result = func(*args)
File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/urlresolvers.py", line 101, in get_callable
not module_has_submodule(import_module(parentmod), submod)):
File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named website
我无法确定这是新 Django 版本 1.5.1 中的错误,或者我正在以不同的方式制作模块,或者我应该重新安装 Django 还是应该使用其他 Django 版本。请建议我是否需要更改我正在使用的 Django?