-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsettings.py
94 lines (75 loc) · 2.19 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
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'l+38ezh8br+y8_-#iphf7xv4a5rzg&wl$5%5p27c*lk6@0m-xo'
DEBUG = True
ALLOWED_HOSTS = ['jeffy.me', 'localhost', '127.0.0.1']
CORS_ORIGIN_ALLOW_ALL = True
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'corsheaders',
'django_crontab',
'rest_framework',
'resource_collector',
'predictive',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'predictive.utils.PageNumberPaginationExt',
'DEFAULT_RENDERER_CLASSES': ('rest_framework.renderers.JSONRenderer',),
'PAGE_SIZE': 10,
}
ROOT_URLCONF = 'predictive_text.urls'
WSGI_APPLICATION = 'predictive_text.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'predictive_text',
'USER': 'root',
'PASSWORD': 'root123456',
'HOST': 'localhost',
'PORT': '3306',
}
}
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"KEY_PREFIX": "django.predictive_text.caches",
"TIMEOUT": 60 * 60 * 24,
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PICKLE_VERSION": -1,
}
}
}
CRONJOBS = [
(
'0 0 * * *',
'django.core.management.call_command',
['crawl_todays_article'],
{},
'>> %s/tmp/cronjobs/crawl_todays_article.log' % BASE_DIR,
),
(
'0 1 * * *',
'django.core.management.call_command',
['analyze_articles'],
{},
'>> %s/tmp/cronjobs/analyze_articles.log' % BASE_DIR,
),
]
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = False