feat: base 将配置文件放到单独的config文件夹中防止误操作

This commit is contained in:
caoqianming 2025-04-23 12:39:16 +08:00
parent cbc667d50c
commit 74581dc906
4 changed files with 17 additions and 3 deletions

2
.gitignore vendored
View File

@ -20,6 +20,8 @@ db.sqlite3
server/conf*.py
server/conf.ini
server/conf*.json
config/conf*.py
config/conf*.json
sh/*
temp/*
nohup.out

12
config/e.conf.py Normal file
View File

@ -0,0 +1,12 @@
SECRET_KEY = 'xx'
DEBUG = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'xx',
'USER': 'postgres',
'PASSWORD': 'xx',
'HOST': 'xx',
'PORT': '5432',
}
}

View File

@ -1,5 +1,5 @@
import os
from . import conf
from config import conf
from celery import Celery
from celery.app.control import Control, Inspect

View File

@ -14,7 +14,7 @@ from datetime import datetime, timedelta
import os
import json
import sys
from .conf import *
from config.conf import *
from django.core.cache import cache
import logging
@ -369,7 +369,7 @@ LOGGING = {
}
##### 加载客户可自定义配置并提供操作方法 #####
SYS_JSON_PATH = os.path.join(BASE_DIR, 'server/conf.json')
SYS_JSON_PATH = os.path.join(BASE_DIR, 'config/conf.json')
def get_sysconfig(key='', default='raise_error', reload=False):
"""获取系统配置可指定key字符串