仅部署时出现Django ViewDoesNotExist错误

时间:2011-01-07 23:30:34

标签: python django

我正在开发一个我认为几乎可以部署的Django应用程序。一切都在开发服务器上运行,但是当在测试Apache / mod_wsgi服务器上托管时,我的每一个视图都会出错。

如果我输入了无效的网址,它会按照预期为我提供有效网址列表,但根据开发服务器,其他任何内容似乎都无法正常工作。

我尝试从本地网络上的其他PC访问,但没有任何乐趣。

如果有人能对这个问题有所了解,我们将不胜感激。到目前为止,好几个小时的阅读并没有帮助。

错误如下;

Environment:

Request Method: GET
Request URL: http://192.168.1.4/results.php
Django Version: 1.2.4
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'results',
 'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
  80.                     response = middleware_method(request)
File "/usr/local/lib/python2.6/dist-packages/django/middleware/common.py" in process_request
  57.             if (not _is_valid_path(request.path_info, urlconf) and
File "/usr/local/lib/python2.6/dist-packages/django/middleware/common.py" in _is_valid_path
  143.         urlresolvers.resolve(path, urlconf)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
  302.     return get_resolver(urlconf).resolve(path)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
  217.                     sub_match = pattern.resolve(new_path)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
  217.                     sub_match = pattern.resolve(new_path)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
  123.             return self.callback, args, kwargs
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in _get_callback
  135.             raise ViewDoesNotExist("Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e)))

Exception Type: ViewDoesNotExist at /results.php
Exception Value: Tried index in module results.views. Error was: 'module' object has no attribute 'cbook'

1 个答案:

答案 0 :(得分:1)

您的results.views文件中存在错误,导致所有错误!

显然是Error was: 'module' object has no attribute 'cbook'。因此,在您的results.views python文件中搜索“cbook”,您可能正在尝试导入cbook或在某处使用它。无论哪种方式,问题都将与“cbook”相关。