Skip to content

Instantly share code, notes, and snippets.

@the-vampiire
Last active April 4, 2018 02:37
Show Gist options
  • Select an option

  • Save the-vampiire/8110045d7540c06cde29e34878420616 to your computer and use it in GitHub Desktop.

Select an option

Save the-vampiire/8110045d7540c06cde29e34878420616 to your computer and use it in GitHub Desktop.
shell script for loading Django environment variables on 'conda activate <env name>' call
# when you call conda activate <env name> this script will be executed
# loads the environment variables automatically on environment activation
# this goes in /anaconda3/envs/ENVIRONMENT-NAME/etc/conda/activate.d
# note: you must create etc/conda in the environment directory to place this file
# for windows users: https://conda.io/docs/user-guide/tasks/manage-environments.html#windows
# spread across multiple lines for readability
# you can write them space-separated in one export statement if you want
export DEBUG='True' # "converted" to boolean in settings.py line 5
export SECRET_KEY='' # TODO: enter your Django secret key here
export DB_HOST='127.0.0.1' # home IP for connecting to the sql proxy connection with the Google Cloud database instance
export DB_PORT='3306' # set this port when using the cloud_sql_proxy tool if you want a different port
export DB_NAME='' # TODO: add the database name [instance id] (the database instance name from Google Cloud -> SQL)
export DB_USER='' # TODO: add the instance username (default is postgres if you did not make a custom one)
export DB_PASSWORD='' # TODO: add the instance password (default is the generated password associated with 'postgres')
export STATIC_URL='/static/' # the name of your static (development) directory
@the-vampiire
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment