Files
material-api/web/config.py
han0 28b1e67f48
Some checks failed
ci / build (push) Failing after 1m54s
fix: ci
2025-10-13 16:04:53 +08:00

80 lines
2.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import logging
import os
PORT = 7778
# 文件路径
APP_ROOT = os.path.abspath(os.path.dirname(__file__))
CACHE_DIR = os.path.join(APP_ROOT, 'cache')
FILE_DIR = os.path.join(APP_ROOT, 'files')
TEMP_DIR = os.getenv('TEMP', '/tmp')
API_ROOT = ''
# 调试模式
APP_MODE = os.getenv('APP_MODE', 'Development') # Development
DEBUG = bool(APP_MODE in ['Development', 'Testing'])
# 密码安全
SECRET_KEY = 'nN<]9Ss32b%GCc,T8q*.^+65A47@=)'
TOKEN_SALT = '20140606'
# 日志
LOG_DIR = '/tmp'
LOG_FORMAT = '%(thread)d %(asctime)s %(filename)s:%(lineno)d %(levelname)s: %(message)s'
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(logging.Formatter(LOG_FORMAT))
logging.getLogger().addHandler(stream_handler)
logging.getLogger().setLevel(logging.DEBUG) # 默认错误日志级别
# 当前服务URL地址
HTTP_BASE_URL = os.getenv('HTTP_BASE_URL', 'http://192.168.1.3:7072')
HTTPS_BASE_URL = os.getenv('HTTPS_BASE_URL', '')
# 数据库
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8' # oracle client 编码
SQLALCHEMY_DATABASE_URI = 'mysql+mysqlconnector://root:XKKFB123456!@mysql:3306/material_manage?charset=utf8mb4&auth_plugin=mysql_native_password'
SQLALCHEMY_TRACK_MODIFICATIONS = False # 设置是否跟踪数据库的修改情况,一般不跟踪
SQLALCHEMY_ECHO = True # 数据库操作时是否显示原始SQL语句一般打开后台要日志
SQLALCHEMY_BINDS = {
# 'arcgis': 'postgres://postgres:lyh123456!@192.168.137.1:7432/dzonemap',
}
SQLALCHEMY_POOL_RECYCLE = 10 * 60 # 空闲该时间后回收数据库连接
# ElasticSearch
ES_HOSTS = os.getenv('ES_HOSTS', 'http://192.168.137.1:9200')
# Redis
REDIS_HOST = os.getenv('REDIS_HOST', 'redis')
REDIS_PORT = int(os.getenv('REDIS_PORT', '6379'))
REDIS_PASSWORD = os.getenv('REDIS_PASSWORD', 'Xxs123456')
REDIS_DB = int(os.getenv('REDIS_DATABASE', '4'))
# Celery
CELERY_BROKER_URL = 'redis://{}{}:{}/{}'.format(
':{}@'.format(REDIS_PASSWORD) if REDIS_PASSWORD else '',
REDIS_HOST,
REDIS_PORT,
REDIS_DB
)
BROKER_URL = CELERY_BROKER_URL
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
# 服务
SERVER_HOST = {
'arcpy': 'http://192.168.137.1:8777',
'wmts': 'http://192.168.137.1:7072',
'geoserver': 'https://xxslyh.cn',
'tianditu': 'https://t{no}.tianditu.gov.cn',
'tianditu_fj': 'http://192.168.137.1:7072',
'tianditu_fj_s0': 'http://s0.fjmap.net',
'file': 'http://192.168.1.3:7072',
'geological_map_service': 'http://192.168.137.1:7026',
'arcgis_server': 'http://192.168.137.247:6080',
'map_service': 'http://192.168.137.1:7028',
}
try:
from local_config import *
except ImportError:
pass