Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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_Url_Flask_Routing_Url Routing - Fatal编程技术网

Python 烧瓶:散列“#&引用;在路由中

Python 烧瓶:散列“#&引用;在路由中,python,url,flask,routing,url-routing,Python,Url,Flask,Routing,Url Routing,我最近正在使用GoogleAPI,并使用简单的flask方法检索一些id_令牌 以下是我的代码和注释中的解释: @app.route('/afterlogin/id_token') def afterlogin(id): # get the id print(id) # print it return render_template(r'creds_view.html', data=id) # and render the template with 'id' in it

我最近正在使用GoogleAPI,并使用简单的flask方法检索一些id_令牌

以下是我的代码和注释中的解释:

@app.route('/afterlogin/id_token')
def afterlogin(id):  # get the id
    print(id)  # print it 
    return render_template(r'creds_view.html', data=id) # and render the template with 'id' in it (for test purposes)
因此,用户登录后,api将
id\u令牌
重定向到
http://localhost:8000/afterlogin/#id_token=some_id_token

但出于某种原因,它显示了404错误。 我想这是因为url中的“#”,我想要
id\u标记。我知道html中的“#”表示“href”中的路径链接或路由

所以我试过了

@app.route('/afterlogin/<path:id>')
@app.route(“/afterlogin/”)
但错误依然存在

有什么猜测吗?

在浏览器本地处理
#
之后,所有内容都不会发送到服务器,因此无法在路由中使用它。省略
#

#
被浏览器本地处理之后,所有内容都不会发送到服务器,因此您不能在路由中使用它。省略
#


URL中的
未发送到服务器后的所有内容,您不能在路由中使用它。@Barmar将其作为答案提交我已通过尝试
http://localhost:8000/afterlogin/#hello
显示我没有找到,而且有趣的是,当我尝试
http://localhost:8000/afterlogin/hey#hello
它打印出
@jamylak我不知道Flask,所以我不知道如何纠正他在做什么。查询参数似乎是显而易见的选择,然后URL中
#
之后的所有内容都不会发送到服务器,您不能在路由中使用它。@Barmar将其作为应答提交。我已通过尝试
http://localhost:8000/afterlogin/#hello
它显示我没有找到,而且有趣的是,当我尝试
http://localhost:8000/afterlogin/hey#hello
它打印出
@jamylak我不知道,所以我不知道如何纠正他在做什么。查询参数似乎是显而易见的选择
http://localhost:8000/afterlogin/some_id_token