Home

Awesome

基于 Django + D2Admin 的运维平台

项目依赖

部署

# 安装前端npm包依赖
cd django_vue_cmdb/d2-admin
npm install
# 修改数据库配置
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'django_vue_cmdb',
        'USER': 'root',
        'PASSWORD': 'Python@123',
        'HOST': '127.0.0.1',
        'PORT': '3306',
    }
}
# 修改Redis配置
CACHES = {
    'default': {
        'BACKEND': 'django_redis.cache.RedisCache',
        'LOCATION': 'redis://127.0.0.1:6379/2',
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "PASSWORD": "Redis@123"
        },
    },
}
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
cd d2-admin
npm run dev
python manage.py runserver localhost:8000
# 修改d2-admin/vue.config.js文件
let publicPath = process.env.VUE_APP_PUBLIC_PATH || '/static/'
# 运行前端打包命令
cd d2-admin
npm run build
# 收集项目所有静态文件
python manage.py collectstatic
# 还原d2-admin/vue.config.js文件
let publicPath = process.env.VUE_APP_PUBLIC_PATH || '/'