django的有用包装器/中间件
django-ajax-redirection的Python项目详细描述
#django的ajax重定向中间件
[![构建状态](https://travis ci.org/hysoftware/django ajax redirection.svg)(https://travis ci.org/hysoftware/django ajax redirection)
[![代码运行状况](https://landscape.io/github/hysoftware/django-ajax-redirection/master/landscape.svg?style=flat)(https://landscape.io/github/hysoftware/django ajax重定向/master)这是什么?
这是django使用ajax时有用的middlware的集合。
例如,[angularjs](https://angularjs.org/)有url路由子系统,
使用ajax。此外,它还支持历史推送状态。这意味着,当使用“https://example.com//login`”访问网站时,地址栏会显示“https://example.com/login`”。但是,访问
``https://example.com/login````,您将得到404,因为http请求
发送到``https://example.com/login````,而不是``https://example.com//login````。
为了避免这个问题,我们应该将路由重定向到`
``https://example.com//login`````,当访问```https://example.com/login```.
此模块提供中间件以避免此问题。
在您的设置中将``DJ`U AJAX`重定向.middleware.ajaxRedirectionMiddleware```
添加到``middleware`类```中。
也就是说,就像这样:
~~~~~
disable撸redirect=[
r“^path撸u to撸u redirect/disable$”
]
~~~~
请注意,静态文件已经添加到禁用列表中。因此,您不需要添加
静态url。
此外,*字符串被视为regexp-s*。
[![构建状态](https://travis ci.org/hysoftware/django ajax redirection.svg)(https://travis ci.org/hysoftware/django ajax redirection)
[![代码运行状况](https://landscape.io/github/hysoftware/django-ajax-redirection/master/landscape.svg?style=flat)(https://landscape.io/github/hysoftware/django ajax重定向/master)这是什么?
这是django使用ajax时有用的middlware的集合。
例如,[angularjs](https://angularjs.org/)有url路由子系统,
使用ajax。此外,它还支持历史推送状态。这意味着,当使用“https://example.com//login`”访问网站时,地址栏会显示“https://example.com/login`”。但是,访问
``https://example.com/login````,您将得到404,因为http请求
发送到``https://example.com/login````,而不是``https://example.com//login````。
为了避免这个问题,我们应该将路由重定向到`
``https://example.com//login`````,当访问```https://example.com/login```.
此模块提供中间件以避免此问题。
在您的设置中将``DJ`U AJAX`重定向.middleware.ajaxRedirectionMiddleware```
添加到``middleware`类```中。
也就是说,就像这样:
~~~~~
disable撸redirect=[
r“^path撸u to撸u redirect/disable$”
]
~~~~
请注意,静态文件已经添加到禁用列表中。因此,您不需要添加
静态url。
此外,*字符串被视为regexp-s*。