Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango 1.4.1 not loading admin site (Django Book tutorial)
    primarykey
    data
    text
    <p>I can't figure out why Django is not loading the admin page. It seems like it isn't even reading the urls.py file that I am editing - because even if I comment out the 'urlpatterns' statement, it still loads the local hello page fine once I run the server.</p> <p>This is the error message:</p> <pre><code>Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/admin Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: ^hello/$ ^time/$ ^time/plus/(\d{1,2})/$ The current URL, admin, didn't match any of these. </code></pre> <p>This is my urlpatterns code:</p> <pre><code>from django.conf.urls import patterns, include, url from mysite.views import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ('^hello/$', hello, ), ('^time/$', current_datetime, ), (r'^time/plus/(\d{1,2})/$', hours_ahead, ), # Examples: # url(r'^$', 'mysite.views.home', name='home'), # url(r'^mysite/', include('mysite.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)) ) </code></pre> <p>And this is a snippet os my settings.py file:</p> <pre><code> MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', # 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', # 'django.contrib.messages.middleware.MessageMiddleware' # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'mysite.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'mysite.wsgi.application' TEMPLATE_DIRS = ( '/Users/pavelfage/Desktop/Coding/mysite/Templates', # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', # 'django.contrib.messages', # 'django.contrib.staticfiles', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'mysite.books' ) </code></pre> <p>Any help much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload