-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig.py
More file actions
51 lines (40 loc) · 1.54 KB
/
config.py
File metadata and controls
51 lines (40 loc) · 1.54 KB
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
"""This file contains all of the Configuration classes for our Application
Configurations should be set with environment variables.
ex export CONFIG=config.ProductionConfig
"""
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
"""Base Class for the rest of our configurations. Initializes access
point for the database and stores Secret Key.
"""
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'app.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False
DEBUG = False
TESTING = False
class ProductionConfig(Config):
"""This configuration should be used in production and set
as an environment variable using
export CONFIG=config.ProductionConfig .
"""
Debug = False
class StagingConfig(Config):
"""Defined variables to be used for staging server."""
DEVELOPMENT = True
DEBUG = True
class DevelopmentConfig(Config):
"""The defacto server for testing your application which sets
debug to true which allows access to Flask's debug mode."""
DEVELOPMENT = True
DEBUG = True
SEND_FILE_MAX_AGE_DEFAULT = 0
class TestingConfig(Config):
"""Config for testing app specifies different temporary database
for Testing database functionality and not saving it.
"""
TESTING = True
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'test.db')