J'essaye de faire fonctionner le site d'administration pour mon projet Django. Je suis ce tutoriel https://docs.djangoproject.com/en/1.4/intro/tutorial02/ et j'utilise Django 1.4.Obtenir le site d'administration pour travailler dans le projet Django
Urls.py:
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^$', include('polls.urls')),
# Examples:
# url(r'^$', 'Blog.views.home', name='home'),
# url(r'^Blog/', include('Blog.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
#url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
Le settings.py est:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'dev.db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
#'django.contrib.admindocs',
)
Le msg d'erreur que je reçois est:
DoesNotExist at /admin/
Site matching query does not exist.
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.4
Exception Type: DoesNotExist
Exception Value:
Site matching query does not exist.
Exception Location: /Users/IMAC/work3/env/lib/python2.7/site-packages/django/db/models/query.py in get, line 366
Python Executable: /Users/IMAC/work3/env/bin/python
Python Version: 2.7.1
Python Path:
['/Users/IMAC/work3/Blog',
'/Users/IMAC/work3/env/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
'/Users/IMAC/work3/env/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
'/Users/IMAC/work3/env/lib/python27.zip',
'/Users/IMAC/work3/env/lib/python2.7',
'/Users/IMAC/work3/env/lib/python2.7/plat-darwin',
'/Users/IMAC/work3/env/lib/python2.7/plat-mac',
'/Users/IMAC/work3/env/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/IMAC/work3/env/Extras/lib/python',
'/Users/IMAC/work3/env/lib/python2.7/lib-tk',
'/Users/IMAC/work3/env/lib/python2.7/lib-old',
'/Users/IMAC/work3/env/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/IMAC/work3/env/lib/python2.7/site-packages']
ne suis pas sûr quel est le problème? Besoin de conseils. Apprécierait toute aide.
Tout d'abord, merci pour aider. J'ai revérifié les erreurs et j'ai aussi posté l'urls.py ci-dessus .. jetez un oeil ... – lakesh
Vous devez exécuter python manage.py syncdb. Vous pouvez donc créer la base de données et créer un super-utilisateur. Je vais changer ma réponse pour vous montrer. – lciamp
couru cela aussi ... – lakesh