我是Django的新手,我主要不会在网站上使用Python。但现在有一个项目需要这样做。我想创建应用程序接口,在那里你发布静态图像的网址,和脚本将生成与Django类似的东西:https://example.com/img?image=xXgGDd5GSjfsdaskDAdsKdkSD76454dfGdDfFs.png。这与给定的静态URL完全相同。我没有问题,创建API,由于这是很多指南,当我谷歌它,但这生成…这是我的问题。
发布于 2019-10-25 01:03:09
这就是你可以做的
dynamic_name_of_image = 'xXg.png``'
url = "https://example.com/img?image=" + str(dynamic_name_of_image),然后重定向此url。
from django.shortcuts import redirect
return redirect('post_list')https://stackoverflow.com/questions/58545885
复制相似问题