【发布时间】:2019-04-22 16:49:26
【问题描述】:
假设我有一个资源,它什么都不做,只是将 url 返回到控制台
from app import api
class StaticFiles(Resource):
def get(self):
return api.url_for(self) # this only provides the resource url
如果请求是 http://localhost:5000/static 上面的代码返回 /static 我在找http://localhost:5000/static
通常我使用请求,但资源中没有请求。
我正在寻找几乎相当于request.base_url
【问题讨论】:
标签: python rest url flask flask-restful