Skip to content

Commit 23f6f48

Browse files
committed
added DJANGO_SETTINGS_MODULE to .bashrc if it doesn't exist
1 parent 545a83d commit 23f6f48

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

fabfile.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ def mkvirtualenv():
8080

8181

8282
def manage(command):
83-
default_settings = '{{ project_name }}.settings.{0}'.format(env.environment)
83+
default_settings = '{{ project_name }}.settings.{0}'.format(
84+
env.environment
85+
)
8486
django_settings = env.get('django_settings', default_settings)
8587

8688
with shell_env(DJANGO_SETTINGS_MODULE=django_settings):
@@ -150,6 +152,15 @@ def bootstrap():
150152

151153
sudo('apt-get update --fix-missing')
152154

155+
with settings(user=env.user):
156+
bashrc = run('cat ~/.bashrc')
157+
if 'DJANGO_SETTINGS_MODULE' not in bashrc:
158+
default_settings = 'sentinel.settings.{0}'.format(
159+
env.environment
160+
)
161+
run('echo "export DJANGO_SETTINGS_MODULE={0}" >> ~/.bashrc'.format(
162+
default_settings))
163+
153164

154165
@task
155166
def provision(branch='master'):

0 commit comments

Comments
 (0)