1
0
forked from erp-dev/erp

feat: stock module

This commit is contained in:
2025-11-04 18:04:27 +08:00
parent 9fde654e2f
commit d88bf367f8
27 changed files with 2238 additions and 561 deletions

View File

@@ -10,9 +10,21 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.2/ref/settings/
"""
# 兼容旧版 django-qiniu-storage
try:
from django.utils.encoding import force_text
except ImportError:
from django.utils.encoding import force_str as force_text
import django.utils.encoding
django.utils.encoding.force_text = force_text
from pathlib import Path
from environ import Env
# 应用七牛云 SDK 补丁(必须在导入其他模块之前)
from flower.qiniu_patch import apply_all_patches
apply_all_patches()
env = Env(
DEBUG=(bool, False),
)
@@ -45,7 +57,7 @@ INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.staticfiles', # 使用七牛云存储不需要staticfiles app
'basic_info',
'stock',
]
@@ -126,7 +138,30 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.2/howto/static-files/
STATIC_URL = 'static/'
# 七牛云存储配置
QINIU_ACCESS_KEY = 'IySZff0zEN7jHeDuxj5PrQNMv0qjKoVqBRCuFMzi'
QINIU_SECRET_KEY = 'Mph5XkjUQO3VHFPT1JulYHY442uMOya2bXjbSZp8'
QINIU_BUCKET_NAME = 'yunwenerp'
QINIU_BUCKET_DOMAIN = 't5510mjho.hn-bkt.clouddn.com'
QINIU_SECURE_URL = False
STORAGES = {
'default': {
'BACKEND': 'qiniustorage.backends.QiniuStorage',
},
'staticfiles': {
'BACKEND': 'qiniustorage.backends.QiniuStorage',
},
}
DEFAULT_FILE_STORAGE = 'qiniustorage.backends.QiniuStorage'
STATICFILES_STORAGE = 'qiniustorage.backends.QiniuStorage'
# 静态文件URL直接从七牛云访问
STATIC_URL = f'http://{QINIU_BUCKET_DOMAIN}/static/'
STATIC_ROOT = 'static'
MEDIA_URL = f'http://{QINIU_BUCKET_DOMAIN}/media/'
# Default primary key field type
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field