- 博客(10)
- 资源 (1)
- 收藏
- 关注
原创 如何在CBV中使用装饰器
文章目录1 装饰器简介2 CBV的装饰器使用1 在路由层使用装饰器2 在视图层中使用装饰器2.1 同时添加多个装饰器2.3 在类中的方法上添加装饰器2.4 直接在类上添加装饰器2.4.1 单独为类中的函数添加装饰器2.4.2 为类中的所有函数添加装饰器3 Django装饰器方法3.1 自定义函数3.2 Django内置装饰器简单介绍(常用)3.2.1 auth模块login_required 方...
2019-06-27 14:23:30 313
原创 virtualenv的简单介绍及使用
virtualenvvirtualenv 介绍virtual environment 虚拟化的python运行环境virtualenv是一个创建独立Python运行环境的工具,主要解决Python软件开发过程中版本和依赖性问题为什么使用virtualenv1. 在没有权限的情况下安装新套件(共享主机无权限在全局目录下)2. 不同应用可以使用不同的套件版本(隔离)3. 套件升级不影响...
2019-08-05 20:39:19 564
原创 Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module
uwsgi部署报错:Fatal Python error: Py_Initialize: Unable to get the locale encodingModuleNotFoundError: No module named ‘encodings’在uwsgi.ini中把virtualenv=/home/.virtualenvs/luku/bin/python改为virtual...
2019-07-20 23:51:39 1006
原创 使用npm run build 打包时报错: TypeError: Cannot read property 'compilation' of undefined
webpack.json 文件内容{ "name": "lcity", "version": "1.0.0", "description": "学城", "author": "liu", "private": true, "scripts": { "dev": "webpack-dev-server --inline --progress --config bui...
2019-07-19 11:22:09 2455 1
原创 django-celery报错:The message has been ignored and discarded. Did you remember to import the module
django-mycelery无法识别应用中的模块所以需要在mycelery配置中对django进行初始化# 把celery和django进行组合,识别和加载django的配置文件os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings.dev")# 在当前celery中启动django框架,对django框架进行初始...
2019-07-18 20:38:48 1153
原创 VMware 无法启动Build environment error! A required application is missing and Modconfig can not continue
VMware 在Ubuntu升级后无法启动提示要安装什么模块,但点击后又报错:"Build environment error! A required application is missing and Modconfig can not continue. xzCheck the log for more details."解决方案:sudo vmware-modconfig --c...
2019-07-13 19:39:43 4119
原创 前后端分离(django+vue)实现分页器
课程列表接口实现分页显示数据在当前子应用courses下创建一个分页器的文件pagination.py,代码:from rest_framework.pagination import PageNumberPaginationclass CoursePageNumberPagination(PageNumberPagination): """课程列表数据的分页器""" pa...
2019-07-06 13:37:42 1552
原创 redis的简单使用
1 安装和配置(linux环境)安装apt-get install redis-server安装目录:/etc/redis/redis.conf配置sudo vim /etc/redis/redis.conf绑定ip:如果需要远程访问,可将此⾏注释,或绑定⼀个真实ipbind 127.0.0.1端⼝,默认为6379port 6379是否以守护进程运⾏[这...
2019-06-29 18:54:23 180
原创 vue Bug: component lists rendered with v-for should have explicit keys.
报错信息 warning in ./src/components/common/Banner.vue(Emitted value instead of an instance of Error) <el-carousel-item v-for="item in banner_list">: component lists rendered with v-for should h...
2019-06-27 14:21:13 895
原创 Django报错解决:RuntimeError: Model class ...apps... doesn't declare an explicit app_label and isn't in a
报错信息RuntimeError: Model class mysite.apps.home.models.Banner doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.分析系统提示应用没有注册,但实际上在seting是有注册的INSTALLED_APPS = [ ....
2019-06-26 20:34:52 19560 2
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人