pip install django -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install django-tinymce -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install PySide2 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install enchant -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install pymysql -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install pymysql -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install pyecharts -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
PyCharm 2022.2.3 终端有点问题,要初始化一下
小白纯新 WINDOWS10 使用Anaconda3搭建dvadmin本地运行环境记录贴 - django-vue-admin 社区
(base) PS D:\Study\Python\django-vue-admin> python3 manage.py makemigrations
(base) PS D:\Study\Python\django-vue-admin> python manage.py makemigrations
D:\Programs\anaconda3\python.exe: can't open file 'D:\Study\Python\django-vue-admin\manage.py': [Errno 2] No such file or directory
(base) PS D:\Study\Python\django-vue-admin> cd .\backend\
(base) PS D:\Study\Python\django-vue-admin\backend> python manage.py makemigrations
请先进行数据库迁移!
请先进行数据库迁移!
No changes detected
(base) PS D:\Study\Python\django-vue-admin\backend> ^C
(base) PS D:\Study\Python\django-vue-admin\backend> python3 manage.py migrate
(base) PS D:\Study\Python\django-vue-admin\backend> python manage.py migrate
请先进行数据库迁移!
请先进行数据库迁移!
Operations to perform:
Apply all migrations: auth, captcha, contenttypes, sessions, system
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying captcha.0001_initial... OK
Applying system.0001_initial... OK
(base) PS D:\Study\Python\django-vue-admin\backend> python manage.py makemigrations
(base) PS D:\Study\Python\django-vue-admin\backend> python manage.py init
[dvadmin.system][dept]初始化完成
[dvadmin.system][role]初始化完成
[dvadmin.system][users]初始化完成
[dvadmin.system][menu]初始化完成
[dvadmin.system][apiwhitelist]初始化完成
[dvadmin.system][dictionary]初始化完成
[dvadmin.system][systemconfig]初始化完成
初始化数据完成!
(base) PS D:\Study\Python\django-vue-admin\backend> python manage.py init_area
正在准备初始化省份数据...
(base) PS D:\Study\Python\django-vue-admin\backend> python manage.py runserver 0.0.0.0:8000
[2022-12-22 14:09:37][django.utils.autoreload.run_with_reloader():636] [INFO] Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
December 22, 2022 - 14:09:37
Django version 3.2.3, using settings 'application.settings'
Starting ASGI/Channels version 3.0.5 development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
[2022-12-22 14:09:38][daphne.server.run():113] [INFO] HTTP/2 support not enabled (install the http2 and tls Twisted extras)
[2022-12-22 14:09:38][daphne.server.listen_success():153] [INFO] Listening on TCP address 0.0.0.0:8000
(base) PS D:\Study\Python\django-vue-admin\backend> npm run dev
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\Study\Python\django-vue-admin\backend/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\Study\Python\django-vue-admin\backend\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\23046\AppData\Local\npm-cache\_logs\2022-12-22T06_10_12_586Z-debug-0.log
(base) PS D:\Study\Python\django-vue-admin\backend> python manage.py runserver 0.0.0.0:8000
[2022-12-22 14:10:47][django.utils.autoreload.run_with_reloader():636] [INFO] Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
December 22, 2022 - 14:10:48
Django version 3.2.3, using settings 'application.settings'
Starting ASGI/Channels version 3.0.5 development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
[2022-12-22 14:10:48][daphne.server.run():113] [INFO] HTTP/2 support not enabled (install the http2 and tls Twisted extras)
[2022-12-22 14:10:48][daphne.server.run():122] [INFO] Configuring endpoint tcp:port=8000:interface=0.0.0.0
[2022-12-22 14:10:48][daphne.server.listen_success():153] [INFO] Listening on TCP address 0.0.0.0:8000
[2022-12-22 14:10:57][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/init/dictionary/?dictionary_key=all 200 [0.00, 127.0.0.1:6679]
[2022-12-22 14:10:57][django.channels.server.log_action():147] [INFO] HTTP GET /api/init/dictionary/?dictionary_key=all 200 [0.01, 127.0.0.1:6679]
[2022-12-22 14:10:57][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/init/settings/ 200 [0.00, 127.0.0.1:6679]
[2022-12-22 14:10:57][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/captcha/ 200 [0.01, 127.0.0.1:6684]
[2022-12-22 14:10:57][django.channels.server.log_action():147] [INFO] HTTP GET /api/init/settings/ 200 [0.02, 127.0.0.1:6679]
[2022-12-22 14:10:57][django.channels.server.log_action():147] [INFO] HTTP GET /api/captcha/ 200 [0.06, 127.0.0.1:6684]
[2022-12-22 14:12:14][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/login/ 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:14][dvadmin.utils.backends.authenticate():19] [INFO] superadmin 正在使用本地登录...
check_hostname requires server_hostname
[2022-12-22 14:12:14][django.channels.server.log_action():147] [INFO] HTTP POST /api/login/ 200 [0.20, 127.0.0.1:6795]
[2022-12-22 14:12:14][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/system/user/user_info/ 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:14][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/user/user_info/ 200 [0.01, 127.0.0.1:6795]
[2022-12-22 14:12:14][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/system/menu/web_router/ 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:15][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/menu/web_router/ 200 [0.02, 127.0.0.1:6795]
[2022-12-22 14:12:15][django.channels.server.log_action():168] [INFO] WebSocket HANDSHAKING /ws/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjcxNjk2NzM0LCJpYXQiOjE2NzE2ODk1MzQsImp0aSI6Ijg0NWViYmNmMWI
yNzRmNjZhYjk4MGQ5YWQ3M2EyNjUwIiwidXNlcl9pZCI6MX0.1u0lApZzDKzGUpppfuCQyN9OWKLV7-aZVV5Agvt_peI/ [127.0.0.1:6815]
[2022-12-22 14:12:15][django.channels.server.log_action():164] [INFO] WebSocket CONNECT /ws/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjcxNjk2NzM0LCJpYXQiOjE2NzE2ODk1MzQsImp0aSI6Ijg0NWViYmNmMWIyNzR
mNjZhYjk4MGQ5YWQ3M2EyNjUwIiwidXNlcl9pZCI6MX0.1u0lApZzDKzGUpppfuCQyN9OWKLV7-aZVV5Agvt_peI/ [127.0.0.1:6815]
[2022-12-22 14:12:22][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/system/menu/ 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:23][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/menu/ 200 [0.35, 127.0.0.1:6795]
[2022-12-22 14:12:24][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/system/dept/?limit=20&page=1&lazy=1 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:24][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/dept/?limit=20&page=1&lazy=1 200 [0.02, 127.0.0.1:6795]
[2022-12-22 14:12:25][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/system/role/?limit=20&page=1 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:25][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/role/?limit=20&page=1 200 [0.02, 127.0.0.1:6795]
[2022-12-22 14:12:26][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/system/user/?user_type=0&query=%7Busername%2Cname%2Cdept%2Crole%2Cmobile%2Cemail%2Cgender%2Cuser_type%2Cis_active%2Cavatar%2Cdescription%2Cmodif
ier_name%2Cdept_belong_id%2Cupdate_datetime%2Ccreate_datetime%2Cdept_name%2Crole_info%7Bname%7D%2Cdept_name_all%2Cid%7D&limit=20&page=1 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:26][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/user/?user_type=0&query=%7Busername%2Cname%2Cdept%2Crole%2Cmobile%2Cemail%2Cgender%2Cuser_type%2Cis_active%2Cavatar%2Cdescription%2Cmodifier_
name%2Cdept_belong_id%2Cupdate_datetime%2Ccreate_datetime%2Cdept_name%2Crole_info%7Bname%7D%2Cdept_name_all%2Cid%7D&limit=20&page=1 200 [0.03, 127.0.0.1:6795]
[2022-12-22 14:12:26][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/system/message_center/?limit=20&page=1 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:26][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/message_center/?limit=20&page=1 200 [0.01, 127.0.0.1:6795]
[2022-12-22 14:12:27][django.channels.server.log_action():147] [INFO] HTTP OPTIONS /api/system/api_white_list/?limit=20&page=1 200 [0.00, 127.0.0.1:6795]
[2022-12-22 14:12:45][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/menu/ 200 [0.02, 127.0.0.1:6795]
[2022-12-22 14:12:46][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/dept/?limit=20&page=1&lazy=1 200 [0.02, 127.0.0.1:6795]
[2022-12-22 14:12:47][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/role/?limit=20&page=1 200 [0.02, 127.0.0.1:6795]
[2022-12-22 14:12:48][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/user/?user_type=0&query=%7Busername%2Cname%2Cdept%2Crole%2Cmobile%2Cemail%2Cgender%2Cuser_type%2Cis_active%2Cavatar%2Cdescription%2Cmodifier_
name%2Cdept_belong_id%2Cupdate_datetime%2Ccreate_datetime%2Cdept_name%2Crole_info%7Bname%7D%2Cdept_name_all%2Cid%7D&limit=20&page=1 200 [0.03, 127.0.0.1:6795]
[2022-12-22 14:12:48][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/message_center/?limit=20&page=1 200 [0.01, 127.0.0.1:6795]
[2022-12-22 14:12:49][django.channels.server.log_action():147] [INFO] HTTP GET /api/system/api_white_list/?limit=20&page=1 200 [0.01, 127.0.0.1:6795]
## 前端♝
```bash
# 克隆项目
git clone https://gitee.com/liqianglog/django-vue-admin.git
# 进入项目目录
cd web
# 安装依赖
npm install --registry=https://registry.npm.taobao.org
# 启动服务
npm run dev
# 浏览器访问 http://localhost:8080
# .env.development 文件中可配置启动端口等参数
# 构建生产环境
# npm run build
后端💈
1. 进入项目目录 cd backend
2. 在项目根目录中,复制 ./conf/env.example.py 文件为一份新的到 ./conf 文件夹下,并重命名为 env.py
3. 在 env.py 中配置数据库信息
mysql数据库版本建议:8.0
mysql数据库字符集:utf8mb4
4. 安装依赖环境
pip3 install -r requirements.txt
5. 执行迁移命令:
python3 manage.py makemigrations
python3 manage.py migrate
6. 初始化数据
python3 manage.py init
7. 初始化省市县数据:
python3 manage.py init_area
8. 启动项目
python manage.py runserver 0.0.0.0:8000
或使用 daphne :
daphne -b 0.0.0.0 -p 8000 application.asgi:application
访问项目
- 访问地址:http://localhost:8080 (默认为此地址,如有修改请按照配置文件)
- 账号:
superadmin
密码:admin123456
``` AttributeError: ‘str‘ object has no attribute ‘decode‘_-JasonWang-的博客-CSDN博客_attributeerror: ‘str’ object has no attribute ’dec