【发布时间】:2014-03-09 08:11:16
【问题描述】:
有没有一种简单的方法来修改视图集和路由器的开箱即用链接?
例如在urls.py中:
from rest_framework import viewsets, routers
...
class Activity_TypeViewSet(viewsets.ModelViewSet):
model = Activity_Type
...
router.register(r'activity_types', Activity_TypeViewSet)
...
url(r'^', include(router.urls)),
这会设置像这样的 url 结构:
{"activity_types": "http://odd.quantdevgroup.com/activity_types/"}
问题归结为建立链接有多容易:
{"activity_types": "**https**://odd.quantdevgroup.com/activity_types/"}
如果我停用 http/ 端口 80 并且只允许 https/ 端口 443,那么我的应用程序需要在无法打开 http 后手动将 https 添加到链接中(因为我禁用了端口 80)。
【问题讨论】:
标签: django ssl https django-rest-framework