ifacethoughts

Django’s SITE_ID

Django has a nice way of publishing content across sites. Using the sites framework one can publish the content on multiple sites and retrieve it for specific sites. There is a configuration parameter – SITE_ID – using which you can specify which the site for which content is to be retrieved. Though not widely discussed, as my friend realized, it can make your content disappear.

I got a frantic call from an acquaintance about Django help. A lot of content on a site he was developing for had vanished. His pages along with his blog posts were not being displayed. All he had done was deleting the old site entry and adding a site entry for the new URL. He even made sure his pages used the new site entry. He could see the data in the admin section, but there was no sign on the site itself. He even restord that data from older backup, but it still didn’t show up! When we discussed the SITE_ID parameter, he mocked at his ability to skip tutorial sections, especially for things that always worked. He had associated his content with the new site entry, but he still had to specify the new site ID (auto incremented in the database) in settings.py. It took us about 15 minutes to find this out, and he had spent about 6 hours trying to fight the disappearance of content.

We enjoyed it, and reminded ourselves that all configuration parameters are important! SITE_ID, specifically, is more important than we think it is.

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.