This repository has been archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
61 lines (42 loc) · 1.72 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
# -*- coding: utf-8 -*-
"""Application configuration."""
import os
from dotenv import load_dotenv
basedir = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(basedir, '.env'))
class Config(object):
"""Base configuration."""
SECRET_KEY = os.environ.get('SECRET_KEY')
if not SECRET_KEY:
raise ValueError("No secret key set for Flask application")
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_TRACK_MODIFICATIONS = False
USERS_PER_PAGE = int(os.environ.get('USERS_PER_PAGE'))
ITEMS_PER_PAGE = int(os.environ.get('ITEMS_PER_PAGE'))
CURRENT_GRAD_CLASS = int(os.environ.get('CURRENT_GRAD_CLASS'))
# Default values for global settings
MAX_DAILY_ALCOHOLIC_DRINKS_PER_USER = \
int(os.environ.get('MAX_DAILY_ALCOHOLIC_DRINKS_PER_USER'))
MINIMUM_LEGAL_AGE = int(os.environ.get('MINIMUM_LEGAL_AGE'))
QUICK_ACCESS_ITEM_ID = int(os.environ.get('QUICK_ACCESS_ITEM_ID'))
# Whooshee configuration
WHOOSHEE_MIN_STRING_LEN = int(os.environ.get('WHOOSHEE_MIN_STRING_LEN'))
class ProductionConfig(Config):
"""Production configuration."""
ENV = 'production'
DEBUG = False
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
class DevelopmentConfig(Config):
"""Development configuration."""
ENV = 'development'
DEBUG = True
DB_NAME = 'development.db'
DB_PATH = os.path.join(Config.PROJECT_ROOT, DB_NAME)
SQLALCHEMY_DATABASE_URI = 'sqlite:///{0}'.format(DB_PATH)
class TestingConfig(Config):
"""Test configuration."""
TESTING = True
DEBUG = True
DB_NAME = 'testing.db'
DB_PATH = os.path.join(Config.PROJECT_ROOT, DB_NAME)
SQLALCHEMY_DATABASE_URI = 'sqlite:///{0}'.format(DB_PATH)