DoesNotExist at /admin/login/
Site matching query does not exist.
Request Method: GET
Request URL: https://tehb123.pythonanywhere.com/admin/login/?next=/admin/
Django Version: 1.9.3
Exception Type: DoesNotExist
Exception Value:
Site matching query does not exist.
Exception Location: /usr/local/lib/python3.5/dist-packages/django/db/models/query.py in get, line 387
Python Executable: /usr/local/bin/uwsgi
Python Version: 3.5.1
Python Path:
['/var/www',
'.',
'',
'/home/tehb123/.local/lib/python3.5/site-packages',
'/var/www',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3/dist-packages',
'/home/tehb123/mysite']
Server time: Thu, 13 Oct 2016 05:34:55 +0000
网址
from django.conf.urls import url, patterns, include
from django.contrib import admin
from django.contrib.flatpages import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('Mysitez.urls')),
# url(r'^pages/', include('django.contrib.flatpages.urls')),
]
urlpatterns += [
url(r'^(?P<url>.*/)$', views.flatpage),
]
设置
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.templatetags',
'django.apps',
'django.contrib.sites',
'django.contrib.flatpages',
'Mysitez',
]
答案 0 :(得分:1)
SITE_ID = 1设置和所有工作,但为什么?没有idae =(
答案 1 :(得分:0)
使用django版本&gt;创建项目后1.6,管理站点将启用django本身。但请确保您有以下[“https://docs.djangoproject.com/en/1.10/ref/contrib/admin/”],创建项目后,生成python manage.py migrate
,然后使用(python manage.py createsuperuser
)创建管理员用户。执行run命令看到的URL(“http://127.0.0.1:8000/admin/”),你可以看到登录页面
答案 2 :(得分:0)
我在this other post中找到了解决方案:
“如果您只从项目中运行一个站点,那么您真的不需要站点框架,因此最简单的解决方法是从INSTALLED_APPS中删除以下项目,错误应该消失:
'django.contrib.sites'
“