Skip to content

Commit

Permalink
added DJANGO_SETTINGS_MODULE to .bashrc if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanP committed Jan 19, 2016
1 parent 545a83d commit 0d1af4c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def mkvirtualenv():


def manage(command):
default_settings = '{{ project_name }}.settings.{0}'.format(env.environment)
default_settings = '{{ project_name }}.settings.{0}'.format(
env.environment
)
django_settings = env.get('django_settings', default_settings)

with shell_env(DJANGO_SETTINGS_MODULE=django_settings):
Expand Down Expand Up @@ -150,6 +152,15 @@ def bootstrap():

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

with settings(user=env.user):
bashrc = run('cat ~/.bashrc')
if 'DJANGO_SETTINGS_MODULE' not in bashrc:
default_settings = '{{ project_name }}.settings.{0}'.format(
env.environment
)
run('echo "export DJANGO_SETTINGS_MODULE={0}" >> ~/.bashrc'.format(
default_settings))


@task
def provision(branch='master'):
Expand Down

0 comments on commit 0d1af4c

Please sign in to comment.