[Django]-How painful is a django project deployment to a live (staging) site?

6👍

Make your development/testing environment match your deployment environment as closely as possible. This means using e.g. PostgreSQL and mod_wsgi instead of SQLite and the built-in server. This software is free so there’s no reason you can’t get your hands on it.

2👍

You might run into problems if you serve your site on a subdirectory of a domain: avoid writing absolute urls by hand, use the url tag instead.

If you rely on initial data in the database, use fixtures.

If your server will be used for multiple sites, consider packaging your site with Virtualenv to avoid dependencies conflicts with the other sites.

You should also use the same database system in your dev and production servers to avoid surprises.

2👍

Use something like south to remove database migration pains, and consider something like buildout or fabric for deployment if you have a reasonably complex project (or have the time to learn these tools), as they will allow easily reproducible scripted deployments.

1👍

I think a lot hangs on the change of the database model. Django can add new columns with syncdb, or generate a script to do that, but it will not remove columns and I don’t think it will remove foreign key constraints from the database even if they do not apply anymore.

So database migration might be best done scripted, and tested on a copy of the production database or some data set closely resembling production data (the same schema of course).

Leave a comment