6

Ok I think I must be missing something. In settings.py I don't see the setting for absolute url for the site. I see there is MEDIA_URL.

django-registration references {{ site }} which is defaulting to example.com but I'm not seeing that in any settings.

If I want the dev.mysite.com and mysite.com to work independently, what do I need to put in settings.py?

supervacuo
  • 9,072
  • 2
  • 44
  • 61
Derek Organ
  • 8,323
  • 17
  • 56
  • 75

2 Answers2

9

The site uses the sites framework. The example.com domain is defined in the database and can be changed with the Django admin.

To use 2 sites simultaneously you will have to change the SITE_ID in the settings and add the extra site in the Django Admin.

Wolph
  • 78,177
  • 11
  • 137
  • 148
  • its not so much I want to use them simultaneously just the dev environment for testing links I guess and the production environment are differently naturally enough. Would it be right to use two different 'sites' in this scenario? – Derek Organ Aug 21 '10 at 03:21
  • It depends I suppose. There are some libraries that use the sites framework to differentiate content. The comments module for example is site specific, so you can add test comments to site 1 without them showing on site 2. But that's only an issue if you plan to share the database between the live and testing environment ofcourse. Personally I never use the sites framework at all. – Wolph Aug 21 '10 at 03:24
  • so in the case of the django registration what would you use to replace {{ site }} – Derek Organ Aug 21 '10 at 03:26
  • Do you want the Django Registration templates to give you the production site or the development site? If you want the development site than you can either create an extra site and use the `site_id` or you can use a separate test database where the site has a different url. In my installations I usually set the `site` to the production url and don't use any other sites. – Wolph Aug 21 '10 at 03:33
0

If you only want to use it from your own code -- just put the domain in a variable in settings-production.py and settings-dev.py (or whatever you choose to call them).

django itself won't do pay any attention to the domain you specify -- but it doesn't need to.

Dan O'Huiginn
  • 364
  • 1
  • 6