Notes by Akhil Saji


Instituting Local and Production Django Settings files

If you do any of your dynamic web development in Django, maintaining separate settings files for your production and development environments is essential. Here I will detail my setup for this process.

1. Create two files called and for your development environment and production environment respectively.

2. In both files, put in the respective Django settings you need. For example in development you might be using SQLite3 as your database but in production you would use PostgreSQL and therefore the database settings would be different.

3. Next, in your put in the following code

        from settings_local import *
except ImportError:
                from settings_server import *
        except ImportError:

4. Finally, ensure that your is excluded from your source management system (i.e git), so when you push your app to the server, only will get pushed. This step is absolutely essential because the code above will always load the local settings as default if available.