When you work in your local machine, most likely you need different settings. You can have this by adding a few lines of codes in your local settings.py. Put this code at the end of your settings.py
... try: from settings_local import * except ImportError: pass
and you create settings_local.py and overwrite some of the configurations and specify them according your local machine, don’t forget to set your version control (git, subversion, mercurial, etc) to ignore this file. For example while your production machine use mysql, you can use sqlite in your local machine:
settings.py
... DATABASE_ENGINE = 'mysql' DATABASE_NAME = 'your-db-name' DATABASE_USER = 'your-db-username' DATABASE_PASSWORD = 'your-password' ...
settings_local.py
DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = 'database.sqlite'
That’s it. Have fun.
Related posts:
[...] This post was mentioned on Twitter by KomunitasWeb, Django Ireland. Django Ireland said: Set Different Settings for Development in Django | KomunitasWeb http://bit.ly/drToJg [...]
Heya¡my very first comment on your site. ,I have been reading your blog for a while and thought I would completely pop in and drop a friendly note. . It is great stuff indeed. I also wanted to ask..is there a way to subscribe to your site via email?
You can follow my twitter or subscribe my feed. :)
I have been looking looking around for this kind of info. Will you publish some more in future? I’ll be grateful if you will.