Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. env = environ.Env(
  2. DEBUG=(bool, False),
  3. SECRET_KEY=(str, ''),
  4. DATABASE_URL=(str, 'postgres://testing:testing@localhost/testing'),
  5. )
  6. if os.path.exists(env_file):
  7. env.read_env(env_file)
  8.  
  9. DEBUG = env.bool('DEBUG')
  10. SECRET_KEY = env.str('SECRET_KEY')
  11. if DEBUG and not SECRET_KEY:
  12. SECRET_KEY = 'xxx'
  13.  
  14. # Default '@localhost' is needed for the production server. But that will probably fail
  15. # on development machine. Write "DEBUG=1" to ".env" file to enable.
  16. if DEBUG:
  17. DATABASE_URL = 'postgres://testing:testing@testing_postgres/testing'
  18.  
  19. DATABASES = {'default': env.db()}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement