Skip to content

Instantly share code, notes, and snippets.

@alialavia
Last active July 12, 2018 18:42
Show Gist options
  • Save alialavia/da1c82a9f5194257d1de868decec933c to your computer and use it in GitHub Desktop.
Save alialavia/da1c82a9f5194257d1de868decec933c to your computer and use it in GitHub Desktop.
import environ
import os
root = environ.Path(__file__) - 2 # two folders back (/a/b/ - 2 = /)
env = environ.Env(DEBUG=(bool, False),) # set default values and casting
GOOGLE_ANALYTICS_ID=env('GOOGLE_ANALYTICS_ID')
SITE_DOMAIN = env('SITE_DOMAIN')
SITE_ROOT = root()
DEBUG = env('DEBUG') # False if not in os.environ
DATABASES = {
'default': env.db(), # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
}
public_root = root.path('./public/')
MEDIA_ROOT = public_root('media')
MEDIA_URL = '/media/'
STATIC_ROOT = public_root('static')
STATIC_URL = '/static/'
AWS_ACCESS_KEY_ID = env('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = env('AWS_SECRET_ACCESS_KEY')
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment