-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zmrenwu
committed
Nov 8, 2018
1 parent
6918233
commit 8265f6c
Showing
4 changed files
with
46 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ celerybeat-schedule | |
*.sage.py | ||
|
||
# Environments | ||
.env | ||
config/settings/.env | ||
.venv | ||
env/ | ||
venv/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,64 @@ | ||
from .common import * | ||
import environ | ||
|
||
DEBUG = False | ||
ALLOWED_HOSTS = ['.dj-china.org', 'localhost', '127.0.0.1', '0.0.0.0'] | ||
SECRET_KEY = os.environ['DJANGO_SECRET_KEY'] | ||
|
||
# envs | ||
MYSQL_HOST = os.getenv('MYSQL_PASSWORD') | ||
MYSQL_DB_NAME = os.getenv('MYSQL_MYSQL_DB_NAME') | ||
MYSQL_DB_USER = os.getenv('MYSQL_MYSQL_DB_USER') | ||
MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD') | ||
env = environ.Env( | ||
# set casting, default value | ||
DEBUG=(bool, True), | ||
SOCIAL_LOGIN_GITHUB_CALLBACK_URL=(str, 'http://127.0.0.1:8000/social-auth/github/loginsuccess') | ||
) | ||
|
||
environ.Env.read_env() | ||
DEBUG = env('DEBUG') # default False | ||
SECRET_KEY = env('SECRET_KEY') | ||
|
||
# sentry dsn | ||
RAVEN_CONFIG = { | ||
'dsn': os.environ.get('SENTRY_DSN', ''), | ||
'dsn': env('SENTRY_DSN'), | ||
} | ||
|
||
# 0: production | ||
# 1: local test | ||
local_test = os.environ.get('LOCAL_TEST', 0) | ||
|
||
if local_test: | ||
DEBUG = True | ||
# sqlite3 | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(BASE_DIR, 'dev.sqlite3'), | ||
# import sentry_sdk | ||
# from sentry_sdk.integrations.django import DjangoIntegration | ||
# | ||
# sentry_sdk.init( | ||
# dsn=env('SENTRY_DSN'), | ||
# integrations=[DjangoIntegration()] | ||
# ) | ||
|
||
# GitHub 登录 | ||
SOCIAL_LOGIN_GITHUB_CALLBACK_URL = env('SOCIAL_LOGIN_GITHUB_CALLBACK_URL') | ||
|
||
# mysql | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.mysql', | ||
'NAME': env('MYSQL_NAME'), | ||
'USER': env('MYSQL_USER'), | ||
'PASSWORD': env('MYSQL_PASSWORD'), | ||
'HOST': 'localhost', | ||
'PORT': '3306', | ||
'OPTIONS': { | ||
'autocommit': True, | ||
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'", | ||
'charset': 'utf8mb4', | ||
}, | ||
'TEST': { | ||
'NAME': 'django_test', | ||
'CHARSET': 'utf8', | ||
'COLLATION': 'utf8_general_ci', | ||
} | ||
} | ||
else: | ||
# database | ||
DATABASES['default'].update( | ||
{'HOST': MYSQL_HOST, | ||
'NAME': MYSQL_DB_NAME, | ||
'USER': MYSQL_DB_USER, | ||
'PASSWORD': MYSQL_PASSWORD, | ||
}) | ||
} | ||
|
||
# 邮件配置,使用腾讯云企业邮箱 | ||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | ||
EMAIL_HOST = 'smtp.exmail.qq.com' | ||
EMAIL_PORT = 465 | ||
EMAIL_USE_SSL = True | ||
EMAIL_USE_LOCALTIME = True | ||
EMAIL_HOST_USER = 'master@dj-china.org' | ||
EMAIL_HOST_PASSWORD = os.environ.get('DJANGO_EMAIL_HOST_PASSWORD', 'fallback_value') | ||
EMAIL_HOST_USER = env('EMAIL_HOST_USER') | ||
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD') | ||
|
||
# Default email address to use for various automated correspondence from the site manager(s). | ||
DEFAULT_FROM_EMAIL = 'Django中文社区 <%s>' % EMAIL_HOST_USER | ||
SERVER_EMAIL = EMAIL_HOST_USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters