forked from AndreiD/Flask-Easy-Template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.py
168 lines (119 loc) · 4.5 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ------- IMPORT DEPENDENCIES -------
import os
import redis
from datetime import timedelta
# ------- IMPORT LOCAL DEPENDENCIES -------
basedir = os.path.abspath(os.path.dirname(__file__))
class BaseConfig(object):
"""
Common configurations
Put any configurations here that are common across all environments
"""
# APPLICATION_ROOT = "/api/v1.0.0"
# URL_PREFIX = '/api/v1.0.0'
# HOST='0.0.0.0'
BOOTSWATCH_THEME = "slate"
ADMIN_EMAIL = "your_email@gmail.com"
DEBUG = False
TESTING = False
SQLALCHEMY_ECHO = False
SQLALCHEMY_DATABASE_URI = ''
APP_NAME = 'WEB API DEMO'
# secret key used also for csrf_token
SECRET_KEY = 'write-a-secret-string-here-or-in-the-instance-secret-folder'
# Fernet key for encryption must be 32 url-safe base64-encoded bytes
FERNET_SECRET_KEY = 'write-a-secret-string-here-or-in-the-instance-secret-folder'
LISTINGS_PER_PAGE = 5
SECURITY_REGISTERABLE = True
SECURITY_RECOVERABLE = True
SECURITY_TRACKABLE = True
SECURITY_PASSWORD_HASH = 'sha512_crypt-here-or-in-the-instance-secret-config-folder'
SECURITY_PASSWORD_SALT = 'add_salt_123_hard_one-or-in-the-instance-secret-config-folder'
SECURITY_CONFIRMABLE = True
# Asset files
UPLOAD_FOLDER = 'app/static/uploads'
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
# limit the maximum allowed payload to 16 megabytes.
# If a larger file is transmitted, Flask will raise an RequestEntityTooLarge exception.
MAX_CONTENT_LENGTH = 16 * 1024 * 1024
THUMBNAIL_SIZE = 128, 128
MAX_SIZE = 1600
# Google map api key
GOOGLE_MAP_API_KEY = ''
# Paypal config
PAYPAL_MODE = "sandbox" # sandbox or live
PAYPAL_CLIENT_ID = "ATcNxfmVFttFZG3v6mnrjkdfjgkfGG9RzZqBZxxxxxxxxxxxxxxxxxxxxxxx"
PAYPAL_CLIENT_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Session
SESSION_PERMANENT = False
# PERMANENT_SESSION_LIFETIME = 5 -> ISSUE : if resized to 5, you'll get csrf_token missing issue
PERMANENT_SESSION_LIFETIME = timedelta(minutes=5)
# SESSION_TYPE = 'sqlalchemy'
# SESSION_SQLALCHEMY = None
# SESSION_SQLALCHEMY_TABLE = 'sessions'
# SESSION_TYPE = 'redis'
# SESSION_REDIS = redis.from_url('127.0.0.1:6379')
# Tod do : fix issue : session file are not removed after the end of the session
SESSION_TYPE = 'filesystem'
SESSION_FILE_DIR = 'sessions'
SESSION_FILE_THRESHOLD = 500
SESSION_FILE_MODE = 600
# CORS CONFIG
CORS_HEADERS = 'Content-Type'
# SendGrid Mail example.
MAIL_SERVER = 'smtp.sendgrid.net'
MAIL_PORT = 587
MAIL_USE_SSL = False
MAIL_USE_TLS = True
MAIL_USERNAME = 'username'
MAIL_PASSWORD = 'password'
DEFAULT_MAIL_SENDER = 'notifications@your_website.com'
SECURITY_EMAIL_SENDER = 'notifications@your_website.com'
RECAPTCHA_SITE_KEY = "6Ldzx_Exxxxxxxxxxxxxxxxxxxxxxx"
RECAPTCHA_SECRET = "6Ldzx_ESAAAxxxxxxxxxxxxxxxxxxxxxxxx"
class ProductionConfig(BaseConfig):
"""
Production configurations
"""
SECRET_CONFIG = 'prod-config.py'
# SQLALCHEMY_DATABASE_URI = 'mysql://user:pass@server_ip:server_port/db_name'
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
# CSRF_ENABLED = True
# WTF_CSRF_ENABLED = True
# useful for paypal return_url and cancel_url config
APP_URL = "quickandclean.org"
PORT = 80
DEBUG = False
# Allow SQLAlchemy to log errors
SQLALCHEMY_ECHO = False
class DevelopmentConfig(BaseConfig):
"""
Development configurations
"""
SECRET_CONFIG = 'dev-config.py'
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'data/db.sqlite')
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
# useful for paypal return_url and cancel_url config
APP_URL = "localhost:5000"
PORT = 5000
DEBUG = True
# Allow SQLAlchemy to log errors
SQLALCHEMY_ECHO = True
class TestingConfig(BaseConfig):
"""
Testing configurations
"""
# useful for paypal return_url and cancel_url config
APP_URL = "localhost:5000"
SECRET_CONFIG = 'test-config.py'
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'data/db.sqlite')
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
TESTING = True
app_config = {
'default': ProductionConfig,
'production': ProductionConfig,
'development': DevelopmentConfig,
'testing': TestingConfig,
}