我是 Django 新手,并遵循此链接中提到的教程:
http://www.djangobook.com/en/2.0/index.html
一切都很顺利,直到我来到第 3 章,创建 Hello World 部分:
http://www.djangobook.com/en/2.0/chapter03.html
我相信我已经信守了一切 - 但是当我尝试访问该网站时:
http://127.0.0.1:8000/hello/
我收到以下错误:
/hello/处的导入错误
没有名为视图的模块
以下是此错误的回溯信息:
Environment:
Request Method: GET
Request URL: `http://127.0.0.1:8000/hello/`
Django Version: 1.5.1
Python Version: 2.7.5
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "E:\DPF\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
103. resolver_match = resolver.resolve(request.path_info)
File "E:\DPF\Python27\lib\site-packages\django\core\urlresolvers.py" in resolve
319. for pattern in self.url_patterns:
File "E:\DPF\Python27\lib\site-packages\django\core\urlresolvers.py" in url_patterns
347. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "E:\DPF\Python27\lib\site-packages\django\core\urlresolvers.py" in urlconf_module
342. self._urlconf_module = import_module(self.urlconf_name)
File "E:\DPF\Python27\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name)
File "E:\Work\Documents\Sites\mysite\mysite\urls.py" in <module>
2. from mysite.views import hello
Exception Type: ImportError at /hello/
Exception Value: No module named views
目录结构如下:
mysite--
mysite--
__init__.py
__init__.pyc
settings.py
settings.pyc
urls.py
urls.pyc
wsgi.py
wsgi.pyc
django.db
manage.py
views.py
知道可能出了什么问题吗?
问候, 英德拉吉特