Moayyad Yaghi
Moayyad Yaghi

Reputation: 3722

django error with admin page

i'm new to django and im trying add a user using django admin page. but i end up with a 404 :

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/admin/auth/user/add/
user not found

what is going on ? am i doing anything wrong ?

here is my urls.py :

from django.conf.urls.defaults import *
from examapp.views import *
import os
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
siteMedia = os.path.join(os.path.dirname(__file__),'site_media')

urlpatterns = patterns('',
                       (r'^admin/', include(admin.site.urls)),
                       )

and here is some of my settings.py :

ROOT_URLCONF = 'exam.urls'

TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__),'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',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    'exam.examapp',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

i use django 1.2 and python 2.7 on windows 7 64x

Please help

thanks in advance

Upvotes: 2

Views: 3151

Answers (2)

Moayyad Yaghi
Moayyad Yaghi

Reputation: 3722

i know it's bad to answer my own question . but i solved it, and if anyone is facing this problem , just re-install django !. and everything should work fine for you.
this is probably because my first installation was from a binary file. i should have used setup.py.

Upvotes: 1

snakile
snakile

Reputation: 54521

I think your admin urlpattern is incorrect. Try this:

urlpatterns = patterns('', 
    (r'^admin/(.*)', admin.site.root),
)

Another possibility: You need to create the necessary tables for the administration application:

python manage.py syncdb. 

Did you syncdb?

Upvotes: 1

Related Questions