简体   繁体   English

无法将图像上传到 django 项目

[英]Not being able to upload image to django project

While I have the images stored into my 'img' file it isn't showing up inside of my virtual environment, I will provide a screenshot of both the images inside of my file plus the virtual environment folder structure.虽然我将图像存储在我的“img”文件中,但它没有显示在我的虚拟环境中,我将提供我文件中的图像以及虚拟环境文件夹结构的屏幕截图。 Below is the error message.下面是错误信息。

Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/static/projects/img/todo.png 'projects\img\todo.png' could not be found找不到页面 (404) 请求方法:GET 请求 URL: http://127.0.0.1:8000/static/projects/img/todo.png 'projects\img\todo.png' 找不到

You're seeing this error because you have DEBUG = True in your Django settings file.您看到此错误是因为您的 Django 设置文件中有 DEBUG = True。 Change that to False, and Django will display a standard 404 page.将其更改为 False,Django 将显示标准 404 页面。

在此处输入图像描述

It would've been much better if you included your urls.py and setting.py but I'm guessing you have not set the static root, in any case by reading this django doc page you should be able to figure it out.如果您包含您的 urls.py 和 setting.py 会更好,但我猜您还没有设置 static 根,无论如何通过阅读此 django 文档页面您应该能够弄清楚。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM