Skip to content

Instantly share code, notes, and snippets.

@alexryabtsev
Created April 4, 2019 21:17
Show Gist options
  • Save alexryabtsev/8acdbe71c83aca23206f81c1cbb7dd03 to your computer and use it in GitHub Desktop.
Save alexryabtsev/8acdbe71c83aca23206f81c1cbb7dd03 to your computer and use it in GitHub Desktop.
import environ
root = environ.Path(__file__) - 3 # get root of the project
env = environ.Env()
environ.Env.read_env() # reading .env file
SITE_ROOT = root()
DEBUG = env.bool('DEBUG', default=False)
TEMPLATE_DEBUG = DEBUG
DATABASES = {'default': env.db('DATABASE_URL')}
public_root = root.path('public/')
MEDIA_ROOT = public_root('media')
MEDIA_URL = env.str('MEDIA_URL', default='media/')
STATIC_ROOT = public_root('static')
STATIC_URL = env.str('STATIC_URL', default='static/')
SECRET_KEY = env.str('SECRET_KEY')
CACHES = {'default': env.cache('REDIS_CACHE_URL')}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment