我安装了transifex - django应用程序。一切看起来都不错,但如果我跑:
./manage runserver 8000
我收到错误消息(如下)。因为我不熟悉django用户据说这是一些容易的错误/错误。不幸的是,我无法发现问题所在。 任何线索将不胜感激! 谢谢,托马斯
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.comments',
'django.contrib.contenttypes',
'django.contrib.flatpages',
'django.contrib.humanize',
'django.contrib.markup',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.admindocs',
'staticfiles',
'notification',
'django_filters',
'django_sorting',
'south',
'tagging',
'tagging_autocomplete',
'pagination',
'piston',
'contact_form',
'ajax_select',
'threadedcomments',
'authority',
'haystack',
'social_auth',
'userena',
'guardian',
'easy_thumbnails',
'djcelery',
'djkombu',
'compressor',
'transifex.txcommon',
'transifex.languages',
'transifex.projects',
'transifex.releases',
'transifex.actionlog',
'transifex.txpermissions',
'transifex.teams',
'transifex.resources',
'django_addons',
'autofetch',
'charts',
'cla',
'copyright',
'datastores',
'gtranslate',
'helptext',
'jsonmap',
'locks',
'lotte',
'priorities',
'suggestions',
'timeline',
'trans_memory',
'txapps',
'txcron',
'txtestsuite',
'watches',
'webhooks',
'widgets']
Installed Middleware:
['django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django_sorting.middleware.SortingMiddleware',
'pagination.middleware.PaginationMiddleware',
'userena.middleware.UserenaLocaleMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware']
Traceback:
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/core/handlers /base.py" in get_response
101. request.path_info)
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/core/urlresolvers.py" in resolve
252. sub_match = pattern.resolve(new_path)
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django /core/urlresolvers.py" in resolve
252. sub_match = pattern.resolve(new_path)
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/core/urlresolvers.py" in resolve
250. for pattern in self.url_patterns:
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/core/urlresolvers.py" in _get_url_patterns
279. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django /core/urlresolvers.py" in _get_urlconf_module
274. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/utils/importlib.py" in import_module
35. __import__(name)
File "/usr/lib/python2.7/site-packages/transifex-1.3.0devel-py2.7.egg/transifex/addons/cla/urls.py" in <module>
2. from transifex.projects.urls import PROJECT_URL
File "/usr/lib/python2.7/site-packages/transifex-1.3.0devel-py2.7.egg/transifex/projects/urls/__init__.py" in <module>
6. from transifex.projects.feeds import LatestProjects, ProjectFeed, ProjectTimelineFeed
File "/usr/lib/python2.7/site-packages/transifex-1.3.0devel-py2.7.egg/transifex/projects/feeds.py" in <module>
11. current_site = Site.objects.get_current()
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/contrib/sites/models.py" in get_current
25. current_site = self.get(pk=sid)
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/db/models/manager.py" in get
132. return self.get_query_set().get(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/db/models/query.py" in get
349. % self.model._meta.object_name)
Exception Type: DoesNotExist at /
Exception Value: Site matching query does not exist.
答案 0 :(得分:2)
首先运行python manage.py syncdb
。然后在django shell中检查此查询:
Site.objects.get(id=1)
如果出现DoesNotExist
错误,请手动创建Site
对象:
Site.objects.create(name='example.com', domain='example.com')