起田(苏州)营销策划有限公司DJANGO项目共用模块系统
Release Summery
1.7.9
- 添加urls_prod, 项目引用时,直接包含此url路由
- 添加qitian-simditor在项目依赖列表
配置文件settings
此项目包含基础项目配置,一般项目可以直接复制settings配置为基础配置。此配置会根据新加入的模块来修改,已有项目不要直接拷贝。
项目依赖文件
此项目的依赖文件要采用手动添加的方法,避免使用freeze方式。目的是为了让依赖项目简洁易读。
管理界面
管理界面使用grappelli,管理首页使用grappelli-dashboard
项目配置信息
APP列表
INSTALLED_APPS = [
'grappelli.dashboard',
'grappelli',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_celery_beat',
'django_celery_results',
'smart_selects',
'easy_thumbnails',
'system',
'simditor',
'autopost',
'usercenter',
'taggit',
'taggit_labels',
'taggit_helpers',
]
在middleware中添加'system.middleware.site.CurrentSiteMiddleware',
template.options添加 'system.context_processors.site_info',
静态文件等配置
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LANGUAGES = (
('en', ('English',)),
('zh-hans', ('中文简体',)),
)
# 翻译文件所在目录,需要手工创建
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
'static/',
]
STATIC_ROOT = 'pub_static/'
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder"
)
# 静态文件版本,发布后,有js,css文件变动需更换
STATIC_VERSION = 0.1
# 项目支付设置
AES_KEY = env.str('AES_KEY')
PAY_PROJECT_ID = env.int('PAY_PROJECT_ID')
PAY_URL = 'https://pay.qitian.biz/pay/index/%d/' % PAY_PROJECT_ID
# SMS模板, 不同项目需要修改
SMS_TEMPLATE = {
'register': '【娱乐信息网】亲爱的{name}贵宾,您的验证码是{code}。有效期为{time}分钟,请尽快验证',
'notice': '【娱乐信息网】主人,客户:{name}已支付订单:{order},请您及时处理!',
'reg_tel_admin': '【娱乐信息网】有手机号:{tel} 用户于{time}注册了{site}, 请尽快联系。',
}
SMS_TIMES = 3
# 设置用户属性
AUTH_PROFILE_MODULE = 'usercenter.QtUser'
# 接口定义
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 20,
'page_query_param': 'page',
}
SHOW_TJ = env.bool('SHOW_TJ')
SITE_NAME = env.str('SITE_NAME')
GRAPPELLI_INDEX_DASHBOARD = 'dashboard.CustomIndexDashboard'
缓存与log设置
# 设置缓存
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
# "PASSWORD": "mysecret"
}
}
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': ('%(asctime)s [%(process)d] [%(levelname)s] ' +
'pathname=%(pathname)s lineno=%(lineno)s ' +
'funcname=%(funcName)s %(message)s'),
'datefmt': '%Y-%m-%d %H:%M:%S',
},
'simple': {
'format': '%(asctime)s [%(levelname)s] %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S',
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple',
},
'console-verbose': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
'log_file': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(BASE_DIR, 'django.log'),
'maxBytes': 33554432,
'formatter': 'verbose',
},
'celery': {
# 'level': 'INFO',
# 'class': 'logging.handlers.RotatingFileHandler',
'level': 'DEBUG',
'formatter': 'simple',
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': 'celery.log',
'when': 'midnight'
},
},
'loggers': {
'django': {
'handlers': ['console', 'log_file'],
'propagate': True,
'level': 'INFO',
},
'qt_celery': {
'handlers': ['celery'],
'level': 'INFO',
'propagate': True,
},
},
}
#七牛配置
# 七牛配置
QINIU_ACCESS_KEY = 'r35LYq6an6L0FUAmDUhqDNXICbtZ5JI1vKWXBGKv'
QINIU_SECRET_KEY = '8GkmiCK4_RjGWLKcJtjIl_8RH9QdnvSI_ulo7Apu'
QINIU_URL = 'https://media.qitian.biz/'
QINIU_BUCKET = 'qitian'
QINIU_FOLDER = 'autopost'
SIMDITOR配置
#SIMDITOR配置
SIMDITOR_UPLOAD_PATH = 'uploads/'
SIMDITOR_IMAGE_BACKEND = 'pillow'
SIMDITOR_TOOLBAR = [
'title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale',
'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link',
'image', 'hr', '|', 'indent', 'outdent', 'alignment', 'fullscreen',
'markdown', 'emoji'
]
SIMDITOR_CONFIGS = {
'toolbar': SIMDITOR_TOOLBAR,
'upload': {
'url': '/simditor/upload/',
'fileKey': 'upload',
'image_size': 1024 * 1024 * 4 # max image size 4MB
},
'emoji': {
'imagePath': '/static/simditor/images/emoji/'
}
}
urls.py中添加
re_path(r'^simditor/', include('simditor.urls')),
更新步骤
autopost模块需要删除: article category author
一定要先添加作者
部署添加前段支持
npm install -g vue-cli
Metadata
Release files for qitian-module 2.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qitian-module-2.0.5.tar.gz | 3.9 MB | Without provenance | Details for qitian-module-2.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qitian_module-2.0.5-py3-none-any.whl | Python 3 | none | any | Details for qitian_module-2.0.5-py3-none-any.whl |
Total release size: 8.2 MB
Release files / qitian-module-2.0.5.tar.gz
| Download URL | qitian-module-2.0.5.tar.gz |
|---|---|
| Size | 3.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2f5beb695cd5d6ad77a370d68fd377e5bc6414f1a2611da311632512927d8b2
|
|
BLAKE2b-256 checksum How to use checksums |
ab85493529290b5f52a6f1f3d163158df859fa74df8e55bd7d845ae8fa11c656
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.5
|
Release files / qitian_module-2.0.5-py3-none-any.whl
| Download URL | qitian_module-2.0.5-py3-none-any.whl |
|---|---|
| Size | 4.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b326192580a93513561f28abc3967c197f9ee5ef03bc01f66790032f25d127f
|
|
BLAKE2b-256 checksum How to use checksums |
1df38af3a996e3fea07dbbd64e46be3c7d8bb6977797fa1f0237803c2818529e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.5
|
Security for qitian-module 2.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.