Snippet List
Deploying relocatable Django sites isn't currently as trivial as it should be (see http://code.djangoproject.com/ticket/8906, http://groups.google.com/group/django-developers/tree/browse_frm/thread/fa3661888716f940/). This snippet relocates all url patterns (similarly to http://djangosnippets.org/snippets/2129/) as well as the absolute url settings of `settings.py`.
This allows deployment under a different mount point with a single Django setting, without having to repeat the mount point again as a SCRIPT_NAME parameter supplied by the web server.
- deployment
- mount point
- relocatable
I wanted a way to deploy a Django site to both the root of a domain, and to a subdirectory. The solution was to loop over all urlpatterns and add a configurable string (URL_PREFIX) at the beginning of all patterns.
- deployment
- subdirectory
- subfolder
Each installation of our Django site has slightly different settings -- namely, which database to use. Developers can provide a `local_settings.py` file which lets them override (or, just as usefully, extend) settings that are in `settings.py`.
Subversion is told to ignore `local_settings.py`, so it's never checked in.
If `local_settings.py` is missing, the site refuses to work.
We include a `local_settings_example.py` file so that new developers can get started more quickly.
- settings
- development
- deployment
- deploy
- production
- local
- local-settings
- local-deployment
I like to keep all local settings files in my versioning repository. The way I differentiate between them is by querying the hostname of the local machine. I've got a host_settings folder with local settings files. Notice that the local settings file names go by a convention where '.' is replaced with underscores.
Example: host_settings/local_machine_tld.py
- settings
- development
- deployment
4 snippets posted so far.