forked from nickjj/build-a-saas-app-with-flask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
175 lines (153 loc) · 5.17 KB
/
settings.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
169
170
171
172
173
174
175
# -*- coding: utf-8 -*-
from os import path
from datetime import timedelta
from celery.schedules import crontab
# This value is used for the following properties,
# it really should be your module's name.
# Database name
# Cache redis prefix
APP_NAME = 'catwatch'
APP_ROOT = path.join(path.dirname(path.abspath(__file__)), '..')
# App settings, most settings you see here will change in production.
SECRET_KEY = 'pickabettersecret'
DEBUG = True
TESTING = False
LOG_LEVEL = 'DEBUG'
# You will need to disable this to get Stripe's webhooks to work because you'll
# likely end up using tunneling tooling such as ngrok so the endpoints are
# reachable outside of your private network.
#
# The problem with this is, Flask won't allow any connections to the ngrok
# url with the SERVER_NAME set to localhost:8000. However if you comment out
# the SERVER_NAME below then webbooks will work but now url_for will not work
# inside of email templates.
#
# A better solution will turn up in the future.
SERVER_NAME = 'localhost:8000'
# Public build path. Files in this path will be accessible to the internet.
PUBLIC_BUILD_PATH = path.join(APP_ROOT, 'build', 'public')
# Flask-Webpack (assets) settings.
WEBPACK_MANIFEST_PATH = path.join(APP_ROOT, 'build', 'manifest.json')
# Babel i18n translations.
ACCEPT_LANGUAGES = ['en', 'es']
LANGUAGES = {
'en': 'English',
'es': u'Español'
}
BABEL_DEFAULT_LOCALE = 'en'
# Seed settings.
SEED_ADMIN_EMAIL = 'dev@localhost.com'
# Database settings,
# The username and password must match what's in docker-compose.yml for dev.
db_uri = 'postgresql://catwatch:bestpassword@localhost:5432/{0}'
SQLALCHEMY_DATABASE_URI = db_uri.format(APP_NAME)
SQLALCHEMY_POOL_SIZE = 5
# Cache settings.
CACHE_TYPE = 'redis'
CACHE_REDIS_URL = 'redis://localhost:6379/0'
CACHE_KEY_PREFIX = APP_NAME
# Celery settings.
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_REDIS_MAX_CONNECTIONS = 5
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
# Celery recurring scheduled tasks.
CELERYBEAT_SCHEDULE = {
'mark-soon-to-expire-credit-cards': {
'task': 'catwatch.blueprints.billing.tasks.mark_old_credit_cards',
'schedule': crontab(hour=12, minute=1)
},
'mark-invalid-coupons': {
'task': 'catwatch.blueprints.billing.tasks.expire_old_coupons',
'schedule': crontab(hour=12, minute=2)
},
}
# Login settings.
REMEMBER_COOKIE_DURATION = timedelta(days=90)
# Mail settings.
MAIL_DEFAULT_SENDER = 'support@catwatch.com'
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USE_SSL = False
MAIL_USERNAME = 'you@gmail.com'
MAIL_PASSWORD = 'awesomepassword'
# External end points.
ENDPOINT_CADVISOR = 'http://localhost:8080/containers/'
ENDPOINT_FLOWER = 'http://localhost:8081'
# Stripe settings.
#
# API keys, NOTE: you should NOT supply them in this config, put them
# in an instance config file, such as: instance/settings.py
#
# They are only listed below to act as documentation.
STRIPE_SECRET_KEY = None
STRIPE_PUBLISHABLE_KEY = None
# The Stripe API version to use. More information can be found on their docs:
# https://stripe.com/docs/api/python#versioning
STRIPE_API_VERSION = '2015-04-07'
# Documentation for each plan field below can be found on Stripe's API docs:
# https://stripe.com/docs/api#create_plan
#
# After supplying both API keys and plans, you must sync the plans by running:
# run stripe sync_plans
#
# If you are using TEST keys then the plans will be set to livemode: False
# If you are using REAL keys then the plans be set to livemode: True
#
# What the above means is, when you ship your app in production you must sync
# your plans at least once to activate them on your real keys.
STRIPE_PLANS = {
'0': {
'id': 'bronze',
'name': 'Bronze',
'amount': 100,
'currency': 'usd',
'interval': 'month',
'interval_count': 1,
'trial_period_days': 14,
'statement_descriptor': 'BRONZE MONTHLY'
},
'1': {
'id': 'gold',
'name': 'Gold',
'amount': 500,
'currency': 'usd',
'interval': 'month',
'interval_count': 1,
'trial_period_days': 14,
'statement_descriptor': 'GOLD MONTHLY',
'metadata': {
'recommended': True
}
},
'2': {
'id': 'platinum',
'name': 'Platinum',
'amount': 1000,
'currency': 'usd',
'interval': 'month',
'interval_count': 1,
'trial_period_days': 14,
'statement_descriptor': 'PLATINUM MONTHLY'
}
}
# Twitter settings.
#
# API keys, NOTE: you should NOT supply them in this config, put them
# in an instance config file, such as: instance/settings.py
#
# They are only listed below to act as documentation.
TWITTER_CONSUMER_KEY = None
TWITTER_CONSUMER_SECRET = None
TWITTER_ACCESS_TOKEN = None
TWITTER_ACCESS_SECRET = None
# Broadcast (websocket server) settings.
#
# NOTE: you should NOT supply the PUSH_TOKEN/BROADCAST_INTERNAL_URL here,
# put them in an instance config file, such as: instance/settings.py
BROADCAST_PUBLIC_URL = 'http://localhost:4242/stream'
BROADCAST_INTERNAL_URL = None
BROADCAST_PUSH_TOKEN = None