https://github.com/chanmo/django-settings
用户可编辑的站点配置
https://github.com/chanmo/django-settings
Last synced: about 1 year ago
JSON representation
用户可编辑的站点配置
- Host: GitHub
- URL: https://github.com/chanmo/django-settings
- Owner: ChanMo
- License: mit
- Created: 2022-05-27T03:09:22.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-14T09:38:10.000Z (almost 4 years ago)
- Last Synced: 2025-03-05T17:49:12.130Z (over 1 year ago)
- Language: Python
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 站点设置
为django提供后台可编辑的配置方案, 同时也方便request调用
## Quick Start
修改`settings.py`
```
INSTALLED_APPS = [
...
'django.contrib.sites',
'settings',
...
]
SITE_ID = 1
```
更新数据库
```
$ ./manage.py makemigrations
$ ./manage.py migrate
```
在views中使用
```
def index(request):
settings = request.site.setting
```
在templates中使用
```
```