Django
Python少年班
最爱vi
展开
-
ModuleNotFoundError: No module named ‘pip‘
ModuleNotFoundError: No module named 'pip'原创 2022-08-02 14:09:48 · 319 阅读 · 0 评论 -
下载 MarkupSafe 报错 ImportError: cannot import name ‘Feature‘
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simpleCollecting MarkupSafe==1.0 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz (14 kB) ERROR: Co原创 2021-04-21 17:50:26 · 547 阅读 · 1 评论 -
Django类视图增加装饰器的许多方法
初始数据views.py文件from django.views import Viewfrom django.http import HttpResponsedef my_decorator(func): def wrapper(request, *args, **kwargs): print('自定义装饰器被调用了') print('请求路径%s' % request.path) return func(request, *args, *原创 2020-10-13 17:54:26 · 272 阅读 · 0 评论 -
git中 .gitignore设置解决办法后不起作用
git中可以设置.gitingnore,可以忽略不想提交的文件或者目录,但是添加后没有忽略又被提交# gitingnore文件内容.idea/log/*.log__pycache__/解决方案# 删除本地缓存git rm -r --cached .# 提交到暂缓区git add .# 提交到本地仓库git commit -m'update .gitingnore'# 提交到远程仓库git push...原创 2020-07-02 00:09:18 · 329 阅读 · 0 评论 -
django2.2报错解决方案: mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required you have 0.9.3
环境:Django==2.2.6Python 3.6mysqlclient=1.4.6报错1:Did you install mysqlclient?解决:#安装pymysqlpip install pymysql#配置文件同级目录下__init__.py文件新增以下代码import pymysqlpymysql.install_as_MySQLdb()报错2:django.core.exceptions.ImproperlyConfigured: mysqlclient原创 2020-06-29 15:48:37 · 298 阅读 · 0 评论 -
Django配置Nginx,域名
1. 阿里云添加域名解析2. 配置Nginx前端 可通过 bk.bkda.cn www.bkda.cn bkda.cn访问页面服务端 可通过 api.bkda.cn/… 访问服务端接口原创 2020-06-15 10:49:16 · 855 阅读 · 0 评论 -
Django根据现有数据库,自动生成models模型文件--inspectdb
Django引入外部数据库 :创建一个项目,修改seting文件,在setting里面设置你要连接的数据库类型和连接名称,地址之类,和创建新项目的时候一致运行下面代码可以自动生成models模型文件Python manage.py inspectdb这样就可以在控制台的命令行中看到数据库的模型文件了把模型文件导入到app中创建一个appdjango-admin.py st...原创 2020-02-07 16:40:47 · 598 阅读 · 0 评论 -
Django 提示: In order to allow non-dict objects to be serialized
return JsonResponse(result)改为:return JsonResponse(result, safe=False)原因def __init__(self, data, encoder=DjangoJSONEncoder, safe=True, json_dumps_params=None, **kwargs): if safe ...原创 2020-05-06 13:31:05 · 583 阅读 · 0 评论 -
stackoverflow Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat )
I’ve installed Python 3.6 and while runningpip install mysql-pythonit gives me the following errorerror: Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)I have a 32bit win 10...原创 2020-04-02 14:15:48 · 397 阅读 · 0 评论 -
linux下载live-server
安装前端服务curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash这一步一定要先关掉第一步时的终端,重新开一个终端nvm install node下载npm install -g live-server进入templates这个文件夹,启动服务器li...原创 2020-02-26 11:15:24 · 780 阅读 · 0 评论