ImageField 和管理面板的问题

发布于 2024-10-09 03:41:37 字数 136 浏览 0 评论 0原文

我知道,这个话题已经出现过很多次了,但没有明确的答案:

以 10 为基数的 int() 的文字无效

我用的是Django。我只想查看我通过管理面板上传的图片。在我的模型中它只是 ImageField。没什么复杂的。

I know, this topic was there many time, but there is no clear answer:

invalid literal for int() with base 10

I use django. I just want to see pictures, which I've uploaded, by admin panel. In my model it's just ImageField. Nothing sophisticated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

dawn曙光 2024-10-16 03:41:37

图片链接指向的 URL 是什么?这应该能让您很好地了解导致问题的原因。

确保设置您的 MEDIA_URL 并且它有一个尾随 /

我猜管理员正在指向一个相对网址。说... /admin/myapp/mymodel/3/images/my-image.png

这是 django 管理的常见错误,因为管理站点需要主键。

What is the URL that the image links point to? That should give you a good idea about what is causing the problem.

Make sure to set your MEDIA_URL and that it has a trailing /

I'm guessing the the admin is pointing to a relative url. Say... /admin/myapp/mymodel/3/images/my-image.png

It's a common error with the django admin because the admin site is expecting a primary key.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文