6👍
The funniest thing is that “example.com” appears in an obvious place. Yet, I was looking for in in an hour or so.
Just use your admin interface -> Sites -> … there it is 🙂
- [Django]-Django-debug-toolbar not showing up
- [Django]-Django: Arbitrary number of unnamed urls.py parameters
- [Django]-Charts in django Web Applications
- [Django]-Getting __init__() got an unexpected keyword argument 'instance' with CreateView of Django
- [Django]-Multiple copies of a pytest fixture
- [Django]-How to get the domain name of my site within a Django template?
4👍
As others have mentioned, this is to do with the default sites
framework.
If you’re using South for database migrations (probably a good
idea in general), you can use a data migration to avoid having to make this same database change everywhere you deploy your application, along the lines of
from south.v2 import DataMigration
from django.conf import settings
class Migration(DataMigration):
def forwards(self, orm):
Site = orm['sites.Site']
site = Site.objects.get(id=settings.SITE_ID)
site.domain = 'yoursite.com'
site.name = 'yoursite'
site.save()
- [Django]-Django humanize outside of template?
- [Django]-Django: TypeError: 'tuple' object is not callable
- [Django]-Make clicked tab active in Bootstrap
2👍
If you are on newer versions of django. the data migration is like this:
from django.conf import settings
from django.db import migrations
def change_site_name(apps, schema_editor):
Site = apps.get_model('sites', 'Site')
site = Site.objects.get(id=settings.SITE_ID)
site.domain = 'yourdomain.com'
site.name = 'Your Site'
site.save()
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.RunPython(change_site_name),
]
- [Django]-How to run a single test or single TestCase with django-nose?
- [Django]-Multiple copies of a pytest fixture
- [Django]-Django 'pip install django-heroku'(psycopg2) error is blocking deployment to Heroku
1👍
When you have edited a Site instance thought the admin, you need to restart your web server for the change to take effect. I guess this must mean that the database is only read when the web server first starts.
- [Django]-Django render_to_string missing information
- [Django]-Django: remove a filter condition from a queryset
- [Django]-How can I use break and continue in Django templates?