Search code examples
pythondjangodjango-modelsdisqus

Installing disqus on django


I am trying to install disqus on my django project. I have followed these instructions:

First, add disqus to your INSTALLED_APPS. You don’t need to run syncdb as there are no models provided.

Next, add DISQUS_API_KEY and DISQUS_WEBSITE_SHORTNAME to your settings. You can get your API key here (you must be logged in on the DISQUS website). To see the shortname of your website, navigate to Settings->General on the DISQUS website.

Finally, you need to change the domain of your Site to the domain you’re actually going to use for your website. The easiest way to do this is to enable django.contrib.admin and just click on the Site object to modify it. If you don’t have contrib.admin installed (or don’t want to install it), you can run python manage.py shell and change the value in the cli:

I am trying to do the last part, the one which starts with the word Finally...

The easiest way to do this is to enable django.contrib.admin and just click on the Site object to modify it.

For this part, i already have django.contrib.admin under my INSTALLED_APPS, but what i dont understand is where is this Site object I am supposed to click. Because of this i tried to use the python manage.py shell approach. The instructions are as follows:

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

s = Site.objects.all()[0]
s.domain = 'arthurkoziel.com'

s.name = 'arthurkoziel.com'
s.save()

Site.objects.all()

Now the problem is when i type from django.contrib.sites.models import Site, i get the following error message:

Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded.

Can anyone who understands the installation process help me out to interpret.


Solution

  • You need to ensure that 'django.contrib.sites' is in your INSTALLED_APPS setting. After this, the above error should go away, and you should also have a "Sites" section in your Django admin.