xadmin-基于Django+vue3的rbac权限管理系统
https://xadmin.dvcloud.xin/ 账号密码:admin/admin123
REDIS_PASSWORD = "nineven"
REDIS_HOST = "redis"
REDIS_PORT = 6379
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'xadmin',
'USER': 'server',
'PASSWORD': 'KGzKjZpWBp4R4RSa',
'HOST': 'mariadb',
'PORT': 3306,
'CONN_MAX_AGE': 600,
# 设置MySQL的驱动
# 'OPTIONS': {'init_command': 'SET storage_engine=INNODB'},
'OPTIONS': {'init_command': 'SET sql_mode="STRICT_TRANS_TABLES"', 'charset': 'utf8mb4'}
},
# "default": {
# "ENGINE": "django.db.backends.sqlite3",
# "NAME": BASE_DIR / "db.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;
}