flask-restful中url_for的使用
2015-06-23 16:03
267 查看
资源路径定义如下:
使用flask中的url_for
或者使用flask-restful中包装后的url_for
输出:/api/users/12
参考http://stackoverflow.com/questions/24223628/how-do-i-use-flask-url-for-with-flask-restful
api.add_resource(UserResource,'/users/<int:id>', endpoint='get_user', methods=['GET'])
使用flask中的url_for
print flask.url_for('api.get_user', id = '123')
或者使用flask-restful中包装后的url_for
print api.url_for(UserResource, id = '123')
输出:/api/users/12
参考http://stackoverflow.com/questions/24223628/how-do-i-use-flask-url-for-with-flask-restful
相关文章推荐
- 学习笔记
- android Service
- Makefile之wildcard
- [Linux] sort命令
- ConcurrentHashMap原理分析
- 锤子新机将在今年(2015)夏天发布 名字不叫小锤子
- Async详解之一:流程控制
- Java中的split函数的用法
- 交叉验证
- 网络通信框架Volley使用详细说明
- 自己动手学TCP/IP–http协议(http报文头)
- 201506231015_《Javascript权威指南(第六版)——作为命名空间的函数、闭包、 》(P181-193)
- 修改文件的所有者和访问权限
- 常见漏洞及处理方法
- 字典转模型
- cPanel添加域名(addondomain)时遇到问题:域名已经解析到其它IP
- 数据库学习之--Oracle 架构与MySQL架构对比
- 利用CSS3实现文本框的清除按钮相关的一些效果
- 类的const、static、const static成员初始化位置及其他需要注意的问题
- http://blog.csdn.net/wangshione/article/details/8491098