-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
62 lines (47 loc) · 1.47 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
'''
Flask App configuration
To set the configuration type, navigate to __init__.py file in the
app directory and change the configuration in the init_app function
Using a production configuration:
app.config.from_object('config.ProdConfig')
Using a development configuration:
app.config.from_object('config.DevConfig')
Configuration Variables:
FLASK_DEBUG: provides logging for debugging purposes
SECRET_KEY: strings used to encrypt sensitive data
SERVER_NAME: app's domian name
More Info:
https://flask.palletsprojects.com/en/3.0.x/config/
'''
from os import environ, path
from dotenv import load_dotenv
BASEDIR = path.abspath(path.dirname(__file__))
load_dotenv(path.join(BASEDIR, '.env'))
class Config:
'''
Base config
'''
SECRET_KEY = environ.get('SECRET_KEY')
SESSION_COOKIE_NAME = environ.get('SESSION_COOKIE_NAME')
STATIC_FOLDER = 'static'
TEMPLATES_FOLDER = 'templates'
# Database
#SQLALCHEMY_DATABASE_URI = environ.get('SQLALCHEMY_DATABASE_URI')
#SQLALCHEMY_TRACK_MODIFICATIONS = False
# AWS Secrets
#AWS_SECRET_KEY = environ.get('AWS_SECRET_KEY')
#AWS_KEY_ID = environ.get('AWS_KEY_ID')
class ProdConfig(Config):
'''
Production config
'''
FLASK_ENV = "production"
FLASK_DEBUG = False
DATABASE_URI = environ.get('PROD_DATABASE_URI')
class DevConfig(Config):
'''
Development config
'''
FLASK_ENV = "development"
FLASK_DEBUG = True
DATABASE_URI = environ.get('DEV_DATABASE_URI')