58π
You donβt really need the sites
framework if you only run one site from the project, so the easiest fix would be to remove the following item from your INSTALLED_APPS
and the error should go away:
'django.contrib.sites'
You can also re-create the missing Site
object from shell. Run python manage.py shell
and then:
from django.contrib.sites.models import Site
Site.objects.create(pk=1, domain='mdev.5buckchuck.com', name='5buckchuck.com')
- [Django]-NoReverseMatch while rendering: Reverse for ''django.contrib.auth.views.login''
- [Django]-Difference between APIView class and viewsets class?
- [Django]-How to change validation error responses in DRF?
1π
I went through this problem too, while playing with django-allauth
. The application offers the ability to delete sites. If you delete the one designated by the SITE_ID
parameter in settings.py
, youβll have to point the correct PK of another valid site.
If you deleted the default site example.com
(changes are you did some cleanup after adding another site), you may simply want to select the other site you created by setting SITE_ID to 2 for example. If you work with SQL database, look for the django_site
table, and locate the site ID you wish to work with.
This way, no need to go into shell and recreating a not necessary desired site.
- [Django]-Django Push HTTP Response to users
- [Django]-Django load block for css
- [Django]-Django logging to console
0π
If you need sites, you can use data fixtures. Read the docs for tip about enabling the sites framework.
- [Django]-Get request body as string in Django
- [Django]-Django Style: Long queries?
- [Django]-Django Tastypie Advanced Filtering: How to do complex lookups with Q objects