0

我在 windows 中执行 django-cms 项目时遇到了麻烦(但我已经尝试过,在 linux 和 mac 中一切正常)我已经按照本页 https://www.django-cms.org/中描述的过程进行操作zh/documentation/ 我遇到的错误是

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 1.4
Python Version: 2.7.2
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.staticfiles',
 'cms',
 'menus',
 'mptt',
 'south',
 'cms.plugins.text',
 'cms.plugins.picture',
 'cms.plugins.link',
 'cms.plugins.file',
 'cms.plugins.snippet',
 'cms.plugins.googlemap',
 'sekizai')
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',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware')


Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
  89.                     response = middleware_method(request)
File "C:\Python27\lib\site-packages\cms\middleware\toolbar.py" in process_request
  33.         request.toolbar = CMSToolbar(request)
File "C:\Python27\lib\site-packages\cms\cms_toolbar.py" in __init__
  61.         self.init()
File "C:\Python27\lib\site-packages\cms\cms_toolbar.py" in init
  65.         self.can_change = (self.request.current_page and
File "C:\Python27\lib\site-packages\cms\middleware\page.py" in __get__
  8.             request._current_page_cache = get_page_from_request(request)
File "C:\Python27\lib\site-packages\cms\utils\page_resolver.py" in get_page_from_request
  91.     pages_root = urllib.unquote(reverse("pages-root"))
File "C:\Python27\lib\site-packages\cms\models\__init__.py" in new_reverse
  51.             url = django.core.urlresolvers.old_reverse(viewname, urlconf=urlconf, args=args, kwargs=kwargs, prefix=prefix, current_app=current_app)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in reverse
  476.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _reverse_with_prefix
  363.         possibilities = self.reverse_dict.getlist(lookup_view)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in reverse_dict
  276.             self._populate()
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _populate
  242.         for pattern in reversed(self.url_patterns):
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in url_patterns
  328.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in urlconf_module
  323.             self._urlconf_module = import_module(self.urlconf_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py" in import_module
  35.     __import__(name)

Exception Type: ImportError at /
Exception Value: No module named urls
4

1 回答 1

1

编辑 settings.py 文件并确保 ROOT_URLCONF 指向您存储 url 的位置。(也许是“[appname].urls”)无论如何,我通常更喜欢将 url 保留在项目根级别。

于 2012-04-09T14:53:26.040 回答