2👍
SITE = 1
will correspond to the default example.com
set by django.contrib.site
.
django.contrib.sites registers a post_migrate signal handler which creates a default site named example.com with the domain example.com. This site will also be created after Django creates the test database.
This is stored in the DB so there’s no way to set this purely in config.
To set it in the DB, follow the steps here:
>>> from django.contrib.sites.models import Site
>>> one = Site.objects.all()[0]
>>> one.domain = 'myveryspecialdomain.com'
>>> one.name = 'My Special Site Name'
>>> one.save()
Then you can run python manage.py dumpdata sites
which produces a JSON of the data you’ve just loaded. Then later load it using django-admin loaddata fixture [fixture ...]
. Otherwise you can set it via the admin interface, under the Site app.
This will display as example.org before it’s fixed:
Change these:
That should fix the issue.
1👍
Why have you set SITE_ID = 1
?
From the Django Docs for django.contrib.site
:
django.contrib.sites registers a post_migrate signal handler which creates a default site named example.com with the domain example.com. This site will also be created after Django creates the test database.
You need to specify the correct SITE_ID
for your current site.
- [Answered ]-I have a list of objects and would like to return an attribute with another attribute
- [Answered ]-How to run 2 sites with Django channels on the same host?
- [Answered ]-DRF – extend obtain auth token
-1👍
What do I need to change so I can access the BlogListView at
http://localhost:8000/posts/2016/07/09 ? Or better via the actual
subdomain of blog.creativeflow.com
I’ve set up my linode with subdomains pointed to different apps and sites. I did this by configuring NGINX webserver and uWSGI web app daemon in “emperor” mode.
To test django-subdomain locally this question on adding subdomains to localhost may help.
- [Answered ]-{{ form.non_field_errors }} with django-crispy-forms
- [Answered ]-CSRF issue with Microsoft Edge and IE11