xadmin-基于Django+vue3的rbac权限管理系统
https://xadmin.dvcloud.xin/ 账号密码:admin/admin123
REDIS_HOST = "redis"
REDIS_PORT = 6379
REDIS_PASSWORD = "nineven"
### 更多数据库配置,参考官方文档:https://docs.djangoproject.com/zh-hans/5.0/ref/databases/
# # mysql 数据库配置
# # create database xadmin default character set utf8 COLLATE utf8_general_ci;
# # grant all on xadmin.* to server@'127.0.0.1' identified by 'KGzKjZpWBp4R4RSa';
# DB_ENGINE = 'django.db.backends.mysql'
# DB_HOST = 'mariadb'
# DB_PORT = 3306
# DB_USER = 'server'
# DB_DATABASE = 'xadmin'
# DB_PASSWORD = 'KGzKjZpWBp4R4RSa'
# DB_OPTIONS = {'init_command': 'SET sql_mode="STRICT_TRANS_TABLES"', 'charset': 'utf8mb4'}
# sqlite3 配置,和 mysql配置 二选一, 默认sqlite数据库
DB_ENGINE = 'django.db.backends.sqlite3'
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py start all
python manage.py runserver 0.0.0.0:8896
python -m celery -A server flower --debug --url_prefix=api/flower --auto_refresh=False --address=0.0.0.0 --port=5566
python -m celery -A server beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler --max-interval 60
python -m celery -A server worker -P prefork -l INFO --autoscale 10,3 -Q celery --heartbeat-interval 10 -n celery@%h --without-mingle
docker compose up -d
python manage.py load_init_json
python manage.py startapp movies
from django.urls import path, include
# 路由配置,当添加APP完成时候,会自动注入路由到总服务
URLPATTERNS = [
path('api/movies/', include('movies.urls')),
]
# 请求白名单,支持正则表达式,可参考settings.py里面的 PERMISSION_WHITE_URL
PERMISSION_WHITE_REURL = []
class ModelLabelFieldSerializer(BaseModelSerializer):
class Meta:
model = models.ModelLabelField
fields = ['pk', 'name', 'label', 'parent', 'created_time', 'updated_time', 'field_type_display']
read_only_fields = ['pk', 'name', 'label', 'parent', 'created_time', 'updated_time']
field_type_display = serializers.CharField(source='get_field_type_display', read_only=True)
docker 环境安装, 官方文档
docker compose up
python manage.py dump_init_json
location /ws/message {
proxy_pass http://127.0.0.1:8896;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto https; # https代理需求添加该参数
}
location ~ ^/(api|flower|media|api-docs) {
proxy_pass http://127.0.0.1:8896;
proxy_send_timeout 180;
proxy_connect_timeout 180;
proxy_read_timeout 180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto https; # https代理需求添加该参数
}
location / {
try_files $uri $uri/ /index.html;
}