ayberkt
ayberkt

Reputation: 105

Django Admin Site Activation

I have been working on the Django tutorial and everything has gone perfect so far.

However in part 2, which teaches how to deal with the admin site, I encountered a problem.

After uncommenting the lines for activating the admin site as told in the tutorial I tried to activate the server and proceeded to the admin site to see the following error:

DoesNotExist at /admin/
Site matching query does not exist

Well, with some googling I managed to resolve it by commenting the line in settings.py:

'django.contrib.sites'

Everything seemed to work fine after doing this, but I guess this is a problem since uncommenting this line is not mentioned in the tutorial

Django: 1.4.3

Python: 2.7.3

Upvotes: 0

Views: 161

Answers (3)

Samir
Samir

Reputation: 111

create a user if it is not done yet:

python manage.py createsuperuser

add to the file settings.py:

 INSTALLED_APPS = [
    ...
    'django.contrib.sites',
    ...

]

and in the bash run :

python manage.py migrate

and enjoy !

Upvotes: 0

aemdy
aemdy

Reputation: 3802

Uncomment django.contrib.sites and run syncdb command. If you have already done that and it doesn't seem to work and you still want to leave sites app uncommented then:

Run ./manage.py shell

from django.contrib.sites.models import Site
Site.objects.create()

After that everything should be just fine. If you would like to modify the new Site record, you can do that in Django admin section sites.

Upvotes: 2

Below the Radar
Below the Radar

Reputation: 7635

Python manage.py syncdb before runserver

Upvotes: 0

Related Questions