还在学习django,今天遇到了一个bug,
这个错误在浏览器的console界面是这样子的,
(index):31 POST http://127.0.0.1:9001/upload_img.html 500 (Internal Server Error)
Uncaught SyntaxError: Unexpected token < in JSON at position 1 at JSON.parse (<anonymous>) at HTMLIFrameElement.reloadIframe1 ((index):35)
搞了我好久时间,查各种博客,最后采取了该方法:
在.html文件下的<script>写入:
$(function () {
localStorage.clear();
});
该代码是为了清除了之前的本地存储;
但是依旧报错!!!抓狂
下面是我的upload.html 和 urls.py的代码图:
令人惊喜的是:我在Pycharm发现了这个错误:
我这个报错的
因此将url.py的
upload_img.html/
改成
upload_img.html
结果成功了 前来记录一下Bug。