Storing editable site content?

Posted by hmp on Programmers See other posts from Programmers or by hmp
Published on 2014-05-10T23:14:14Z Indexed on 2014/06/01 21:55 UTC
Read the original article Hit count: 225

We have a Django-based website for which we wanted to make some of the content (text, and business logic such as pricing plans) easily editable in-house, and so we decided to store it outside the codebase. Usually the reason is one of the following:

  • It's something that non-technical people want to edit. One example is copywriting for a website - the programmers prepare a template with text that defaults to "Lorem ipsum...", and the real content is inserted later to the database.

  • It's something that we want to be able to change quickly, without the need to deploy new code (which we currently do twice a week). An example would be features currently available to the customers at different tiers of pricing. Instead of hardcoding these, we read them from database.

The described solution is flexible but there are some reasons why I don't like it.

  • Because the content has to be read from the database, there is a performance overhead.

    We mitigate that by using a caching scheme, but this also adds some complexity to the system.

  • Developers who run the code locally see the system in a significantly different state compared to how it runs on production. Automated tests also exercise the system in a different state. Situations like testing new features on a staging server also get trickier - if the staging server doesn't have a recent copy of the database, it can be unexpectedly different from production.

    We could mitigate that by committing the new state to the repository occasionally (e.g. by adding data migrations), but it seems like a wrong approach. Is it?

Any ideas how best to solve these problems? Is there a better approach for handling the content that I'm overlooking?

© Programmers or respective owner

Related posts about django

Related posts about repository