feat: 配置时间区域 启动前先执行迁移数据库
This commit is contained in:
parent
4274504b31
commit
58a93e1aa1
@ -101,6 +101,9 @@ class Config(dict):
|
|||||||
def get_debug(self) -> bool:
|
def get_debug(self) -> bool:
|
||||||
return self.get('DEBUG') if 'DEBUG' in self else True
|
return self.get('DEBUG') if 'DEBUG' in self else True
|
||||||
|
|
||||||
|
def get_time_zone(self) -> str:
|
||||||
|
return self.get('TIME_ZONE') if 'TIME_ZONE' in self else 'Asia/Shanghai'
|
||||||
|
|
||||||
def get_db_setting(self) -> dict:
|
def get_db_setting(self) -> dict:
|
||||||
return {
|
return {
|
||||||
"NAME": self.get('DB_NAME'),
|
"NAME": self.get('DB_NAME'),
|
||||||
|
|||||||
@ -15,7 +15,6 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = 'django-insecure-g1u*$)1ddn20_3orw^f+g4(i(2dacj^awe*2vh-$icgqwfnbq('
|
SECRET_KEY = 'django-insecure-g1u*$)1ddn20_3orw^f+g4(i(2dacj^awe*2vh-$icgqwfnbq('
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = CONFIG.get_debug()
|
DEBUG = CONFIG.get_debug()
|
||||||
|
|
||||||
@ -154,7 +153,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
|
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
TIME_ZONE = CONFIG.get_time_zone()
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
|
|||||||
@ -8,9 +8,13 @@ EMAIL_HOST_USER:
|
|||||||
EMAIL_HOST_PASSWORD:
|
EMAIL_HOST_PASSWORD:
|
||||||
|
|
||||||
# 数据库链接信息
|
# 数据库链接信息
|
||||||
DB_NAME: smart-doc
|
DB_NAME: maxkb
|
||||||
DB_HOST: localhost
|
DB_HOST: localhost
|
||||||
DB_PORT: 5432
|
DB_PORT: 5432
|
||||||
DB_USER: root
|
DB_USER: root
|
||||||
DB_PASSWORD: xxx
|
DB_PASSWORD: xxxxxxx
|
||||||
DB_ENGINE: django.db.backends.postgresql_psycopg2
|
DB_ENGINE: django.db.backends.postgresql_psycopg2
|
||||||
|
|
||||||
|
DEBUG: false
|
||||||
|
|
||||||
|
TIME_ZONE: Asia/Shanghai
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user