-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
63 lines (46 loc) · 1.7 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
import os
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
basedir = os.path.abspath(os.path.dirname(__file__))
HEROKU_URI = 'postgres://iwcxypoullcotd:344b3734ff9c793c50bceeb5314efa108e80e4675c7081f53dab5f6c04907c5a@ec2-184-73-189-190.compute-1.amazonaws.com:5432/dfq6o8fr8mc2bb'
HEROKU_DEV_URI = 'postgresql://postgres:dhy94113@localhost:5432/postgres'
class config(object):
# Secret key
SECRET_KEY = os.environ.get('SECRET_KEY') or 'Cucumis'
# SQLALCHEMY Setting
SQLALCHEMY_TRACK_MODIFICATIONS = True
# APScheduler
JOBS = [{
'id': 'update-sqlcache',
'func': 'app.spider.dbhelper:cache_update_with_context',
'trigger': 'interval',
'seconds': 60 * 30,
'replace_existing': True,
}]
SCHEDULER_API_ENABLED = True
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or HEROKU_DEV_URI
SCHEDULER_JOBSTORES = {
'default': SQLAlchemyJobStore(SQLALCHEMY_DATABASE_URI)
}
class TestingConfig(config):
TESTING = True
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'test')
SCHEDULER_JOBSTORES = {
'default': SQLAlchemyJobStore(SQLALCHEMY_DATABASE_URI)
}
class ProductionConfig(config):
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or HEROKU_URI
SCHEDULER_JOBSTORES = {
'default': SQLAlchemyJobStore(SQLALCHEMY_DATABASE_URI)
}
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': ProductionConfig,
}