TG-103 Amélioration structure du projet
This commit is contained in:
45
backend/app/config.py.example
Normal file
45
backend/app/config.py.example
Normal file
@ -0,0 +1,45 @@
|
||||
import os
|
||||
|
||||
|
||||
class Config:
|
||||
ACTIVE_CONFIG = "app.config.Prod"
|
||||
|
||||
@staticmethod
|
||||
def configure_app(config="prod"):
|
||||
if config.lower() == "prod":
|
||||
Config.ACTIVE_CONFIG = 'app.config.Prod'
|
||||
elif config.lower() == "debug":
|
||||
Config.ACTIVE_CONFIG = 'app.config.Debug'
|
||||
elif config.lower() == "test":
|
||||
Config.ACTIVE_CONFIG = 'app.config.Test'
|
||||
else:
|
||||
raise Exception('{} n\'est pas configuration une configuration valide'.format(config))
|
||||
|
||||
DEBUG = False
|
||||
TESTING = False
|
||||
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
SQLALCHEMY_DATABASE_URI = \
|
||||
'sqlite:///' + os.path.join(BASE_DIR, '../app.db')
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
THREADS_PER_PAGE = 2
|
||||
SECRET_KEY = "secret"
|
||||
BUNDLE_ERRORS = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
SESSION_VALIDITY_DURATION_WITHOUT_ACTIVITY_MIN = 20
|
||||
|
||||
|
||||
class Prod(Config):
|
||||
SQLALCHEMY_DATABASE_URI = 'mysql://user@localhost/foo'
|
||||
|
||||
|
||||
class Debug(Config):
|
||||
DEBUG = True
|
||||
SESSION_COOKIE_SECURE = False
|
||||
SQLALCHEMY_DATABASE_URI = 'mysql://ola:ola@localhost/OLA'
|
||||
|
||||
|
||||
class Test(Config):
|
||||
TESTING = True
|
||||
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
SQLALCHEMY_DATABASE_URI = \
|
||||
'sqlite:///' + os.path.join(BASE_DIR, '../test.db')
|
Reference in New Issue
Block a user