No Description

config.py 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # -*- encoding: utf-8 -*-
  2. """
  3. License: MIT
  4. Copyright (c) 2019 - present AppSeed.us
  5. """
  6. import os
  7. from os import environ
  8. class Config(object):
  9. basedir = os.path.abspath(os.path.dirname(__file__))
  10. SECRET_KEY = 'key'
  11. # This will create a file in <app> FOLDER
  12. SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'database.db')
  13. # For 'in memory' database, please use:
  14. # SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
  15. SQLALCHEMY_TRACK_MODIFICATIONS = False
  16. # THEME SUPPORT
  17. # if set then url_for('static', filename='', theme='')
  18. # will add the theme name to the static URL:
  19. # /static/<DEFAULT_THEME>/filename
  20. # DEFAULT_THEME = "themes/dark"
  21. DEFAULT_THEME = None
  22. class ProductionConfig(Config):
  23. DEBUG = False
  24. # Security
  25. SESSION_COOKIE_HTTPONLY = True
  26. REMEMBER_COOKIE_HTTPONLY = True
  27. REMEMBER_COOKIE_DURATION = 3600
  28. # PostgreSQL database
  29. SQLALCHEMY_DATABASE_URI = 'postgresql://{}:{}@{}:{}/{}'.format(
  30. environ.get('APPSEED_DATABASE_USER', 'appseed'),
  31. environ.get('APPSEED_DATABASE_PASSWORD', 'appseed'),
  32. environ.get('APPSEED_DATABASE_HOST', 'db'),
  33. environ.get('APPSEED_DATABASE_PORT', 5432),
  34. environ.get('APPSEED_DATABASE_NAME', 'appseed')
  35. )
  36. class DebugConfig(Config):
  37. DEBUG = True
  38. config_dict = {
  39. 'Production': ProductionConfig,
  40. 'Debug': DebugConfig
  41. }