whitebear
whitebear

Reputation: 12433

Django keep different database setting in each servers

I am deploying capistrano to Django project.

And database settings differs from local to server.

So at first I set linked_files in deploy.rb.

append :linked_files, "app/settings.py"

With this setting, deployment doesn't update the app/settings.py on server.

However sometimes, I need to add app setting to this file, so it should be synced to server's.

Is there any good practice to deploy django project by tools and keep only database setting in each server??

Upvotes: 0

Views: 121

Answers (1)

Ojas Kale
Ojas Kale

Reputation: 2159

In such setups one way could be to use app/settings/local.local and app/settings/prod.py files. a make target should copy the app/settings/local.local file to app/settings/local.py and use this file. This way in settings you always have one .py file. all the changes to local.local are synced with git.

local.py should be added to gitignore. __init__.py in settings folder should import from all the py files.

settings
|
| -- __init__.py
| -- local.local
| -- prod.py

somethings like this.

Upvotes: 1

Related Questions