做Vue+Django REST framework电商项目遇到的问题

问题1:

刷新前端注册页面图片验证码显示不出来的时候(image_id临时保存在redis中)
前端检查里的console显示:
(507) Insufficient Storage

Django后端报错:

ERROR exceptions 26 [] MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
ERROR basehttp 124 "GET /image_codes/ca845c7c-c3ac-4ca9-ae3f-652027381c7b/ HTTP/1.1" 507 35

大意为:(错误)misconf redis被配置以保存数据库快照,但misconf redis目前不能在硬盘上持久化。用来修改数据集合的命令不能用,请使用日志的错误详细信息。

这是由于强制停止redis快照,不能持久化引起的

解决方法:通过redis-cli连接到服务器后执行以下命令:

config set stop-writes-on-bgsave-error no

 

问题2:

测试web时,报错:django.template.exceptions.TemplateDoesNotExist: rest_framework/api.html

做Vue+Django REST framework电商项目遇到的问题_第1张图片

Django后端报错:

django.template.exceptions.TemplateDoesNotExist: rest_framework/api.html
ERROR basehttp 124 "GET /sms_codes/18516952650/?text=nmub&image_code_id=e5d4c09a-6cf2-43d3-931e-18e158a1b6b9 HTTP/1.1" 500 85501

 

解决办法:    

            在配置文件中配置rest_framework库,setting文件中的参数INSTALLED_APPS加上rest_framework

做Vue+Django REST framework电商项目遇到的问题_第2张图片

 

转载于:https://www.cnblogs.com/zhangdajin/p/11124238.html

你可能感兴趣的:(做Vue+Django REST framework电商项目遇到的问题)