django-提交订单
摘要:购物车cart.html页面加form表单提交 视图函数views.py添加orderplace功能 模板order_place.html 后台views.py处理订单功能orderCommit 此时需要在orders/models.py中OrderInfo方法中添加字典
阅读全文
django-购物车添加
摘要:商品详情页detail.html添加加入购物车按钮 视图函数views.py中添加add功能 购物车页面 跳转到购物车 base.html中 视图函数views.py添加CartInfoView视图功能 模板cart.html 视图函数views.py中添加购物车更新和删除功能
阅读全文
上传图片报错
摘要:浏览器显示 linux终端显示 错误原因 没运行nginx fdfs_tracker和fdfs_storage配置看下,重启下
阅读全文
Pycharm中打开Terminal方式
摘要:点击剪头的图标就可以在左侧出现Terminal
阅读全文
django-全文解锁和搜索引擎
摘要:安装和配置 全文检索安装 搜索引擎安装 安装支持中文的搜索引擎 2) 找到虚拟环境py_django下的haystack目录。 /home/python/.virtualenvs/bj17_py3/lib/python3.5/site-packages/haystack/backends/ 在目录中
阅读全文
django-用户浏览记录添加及商品详情页
摘要:视图函数views.py 模板detail.html
阅读全文
django-模板变量forloop
摘要:在django的模板中,有forloop这一模板变量,颇似php Smarty中的foreach.customers, Smarty foreach如下: {foreach name=customers from=$custid item=curr_id}{$smarty.foreach.custo
阅读全文
django-带参数路由
摘要:路由urls.py templates渲染页面中
阅读全文
django-获取购物车商品数量-redis
摘要:视图函数views.py中 模板文件index.html 设置cart_key的数据
阅读全文
django-配置静态页面-celery/redis/nginx
摘要:celery生成静态页面 celery_tasks/tasks.py 模板文件 static_index.html 启动celery 生成静态页面 配置nginx.conf sudo vi /usr/local/nginx/conf/nginx.conf中在http中添加 重启nginx 浏览器中
阅读全文
django-自定义文件上传存储类
摘要:文件储存API:https://yiyibooks.cn/xx/django_182/ref/files/storage.html 编写自定义存储系统:https://yiyibooks.cn/xx/django_182/howto/custom-file-storage.html 定义一个自定义的
阅读全文
django-安装nginx及fastdfs-nginx-module
摘要:安装nginx及fastdfs-nginx-module 1. 解压缩 nginx-1.8.1.tar.gz 2. 解压缩 fastdfs-nginx-module-master.zip 3. 进入nginx-1.8.1目录中 4. 执行 sudo ./configure --prefix=/usr
阅读全文
django-文件上传和下载--fastDFS安装和配置
摘要:5.1 安装fastdfs依赖包 一:下载安装FDFS依赖: libfastcommon 下载地址:https://codeload.github.com/happyfish100/libfastcommon/zip/master 1. 解压缩libfastcommon-master.zip 2.
阅读全文
django-缓存django-redis
摘要:https://django-redis-chs.readthedocs.io/zh_CN/latest/ 安装 django-redis 最简单的方法就是用 pip : cache backend 使用配置settings.py 链接redis数据库,原生客户端使用 在某些情况下你的应用需要进入原
阅读全文
django-改写manage类-objects
摘要:user/models.py中 视图函数views.py中直接调用方法
阅读全文
django-登录后得个人信息
摘要:Web请求中的认证:https://yiyibooks.cn/xx/django_182/topics/auth/default.html Django使用会话和中间件来拦截request 对象到认证系统中。 它们在每个请求上提供一个request.user属性,表示当前的用户。如果当前的用户没有登
阅读全文
django-登录认证
摘要:login_required 装饰器 1.直接调用 在路由中应用login_required装饰器user/urls.py login_required()完成下面的事情: 如果用户没有登入,则重定向到settings.LOGIN_URL,并将当前访问的绝对路径传递到查询字符串中。例如:/accou
阅读全文
django-登录和退出及redis存储session信息
摘要:登录 1.视图函数views.py 2.模板login.html 3.使用django-redis django-redis文档:https://django-redis-chs.readthedocs.io/zh_CN/latest/ 配置settings.py文件 报错 原因django-red
阅读全文
djiango-异步发送邮件--celery
摘要:安装 1.项目目录里新建一个celery的包celery_tasks tasks.py中 2.在视图函数中导入tasks包就行 3.启动redis 执行celery命令 celery -A celery_tasks.tasks worker -l info 报错 这是因为pip没装redis 安装r
阅读全文