Zapoznaję się z Django.Django - wyświetlono stronę 404 dla serwera WWW dev (http://127.0.0.1:8000/)
Z powodzeniem zainstalowałem i przetestowałem witrynę demonstracyjną. Teraz chcę włączyć moduł administracyjny, aby zobaczyć, co się stanie.
Kroki brałem (przyznane, niektóre były niepotrzebne, ale chciałem się upewnić, zacząłem z czystym kontem):
- redakcją mysite/settings.py włączyć Admin
- Edytowane mojawitryna/url.py włączyć administrator
- spadła i odtworzyć moje backend db
- prowadzony ./manage.py syncdb (i odpowiedział poprawnie na monity)
- rozpoczęła serwer dev internetowej (./manange.py runserver)
Oto co mój plik mysite/settings.py wygląda (tylko odpowiedniej części)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# The next lines are my models
'mysite.foo',
'mysite.foobar',
)
Oto co wygląda mój plik mysite/urls.py jak:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
)
Gdy przeglądam adres URL serwera, otrzymuję odpowiedź:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
1. ^admin/doc/
2. ^admin/
The current URL, , didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Co za m robię źle?