Flask 动态主机路径
我有以下几个简单的例子 模板/fileform.htmlFlask 动态主机路径,flask,Flask,我有以下几个简单的例子 模板/fileform.html <html> <head> <title>Simple file upload using Python Flask</title> </head> <body> <form action="/getSignature" method="post" enctype="multipar
<html>
<head>
<title>Simple file upload using Python Flask</title>
</head>
<body>
<form action="/getSignature" method="post" enctype="multipart/form-data">
Choose the file: <input type="file" name="photo"/><BR>
<input type="submit" value="Get Signature"/>
</form>
</body>
</html>
<html>
<body>
<p>Signature for file : {{ variable }}</p>
</body>
</html>
这在本地主机上运行良好。但是我通过Nginx
在domain.com/signature
上提供它。当我单击“获取签名”时,它会转到domain.com/getSignature
并显示
405 Method Not Allowed
Code: MethodNotAllowed
Message: The specified method is not allowed against this resource.
Method: POST
ResourceType: OBJECT
RequestId: CAB22446BEAE3B3F
HostId: cYGbt4sjHpFfrp6iBXvuYx4qzk7dkT4BqpNNJYFbeMjz34kYLtnr/RTxp8CsqvEoHTx/fVQmWsE=
它需要转到domain.com/signature/getSignature
我试图添加app.config[“APPLICATION\u ROOT”]=“/signature/”
,但没有成功
如何更改路由的主机(“/getSignature”)?如果Nginx将表单操作代理到路由,则表单操作应转到Nginx端点。根据您所说的,Nginx正在收听
domain.com/signature
尝试一下
<form action="domain.com/signature/getSignature" method="post" enctype="multipart/form-data">
Choose the file: <input type="file" name="photo"/><BR>
<input type="submit" value="Get Signature"/>
</form>
选择文件:
或
选择文件:
<form action="domain.com/signature/getSignature" method="post" enctype="multipart/form-data">
Choose the file: <input type="file" name="photo"/><BR>
<input type="submit" value="Get Signature"/>
</form>
<form action="/signature/getSignature" method="post" enctype="multipart/form-data">
Choose the file: <input type="file" name="photo"/><BR>
<input type="submit" value="Get Signature"/>
</form>