Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 金字塔将用户定向到不同的域_Python_Ajax_Pyramid - Fatal编程技术网

Python 金字塔将用户定向到不同的域

Python 金字塔将用户定向到不同的域,python,ajax,pyramid,Python,Ajax,Pyramid,我想将我的用户重定向到另一个域。例如:我的站点是,我想将它们重定向到 我希望重定向发生在表单提交之后。这在金字塔网络框架中是可能的吗 或者,使用AJAX post请求到服务器,然后使用javascript重定向是最好的方法 谢谢。在成功提交表单后,返回HTTPFound以及所需位置 from pyramid.httpexceptions import HTTPFound def form_received_here(request): # do stuff here retur

我想将我的用户重定向到另一个域。例如:我的站点是,我想将它们重定向到

我希望重定向发生在表单提交之后。这在金字塔网络框架中是可能的吗

或者,使用AJAX post请求到服务器,然后使用javascript重定向是最好的方法


谢谢。

在成功提交表单后,返回HTTPFound以及所需位置

from pyramid.httpexceptions import HTTPFound

def form_received_here(request):
    # do stuff here
    return HTTPFound('http://example.com')

这将返回一个状态代码302,其
位置
标题设置为
http://example.com

啊,谢谢,我正在使用HTTPFound,但是位置=request.route\u url('http…')。