-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathconfig.py
39 lines (30 loc) · 1.02 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
import os
from datetime import timedelta
from celery.schedules import crontab
class BaseConfig:
DEBUG=False
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = 'sqlite:///%s' % (os.path.join(PROJECT_ROOT, "db.sqlite3"))
SQLALCHEMY_TRACK_MODIFICATIONS = True
CELERYBEAT_SCHEDULE = {
'generate_contacts': {
'task': 'app.contacts.tasks.generate_random_contact',
'schedule': timedelta(seconds=15),
},
'clean_contacts': {
'task': 'app.contacts.tasks.clean_contacts',
'schedule': timedelta(minutes=1),
},
}
class DevelopmentConfig(BaseConfig):
ENV='development'
DEBUG = True
DOMAIN = 'http://localhost:5000'
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
class TestingConfig(BaseConfig):
ENV='testing'
TESTING = True
DOMAIN = 'http://testserver'
# Use memory for DB files
SQLALCHEMY_DATABASE_URI = 'sqlite://'