在后端使用Django和Gunicorn,每次我提交表单并应该被发送到
default.conf:
example.com/pagetwo
时,我却被发送到localhost/pagetwo
。由于我对Nginx不熟悉,如果有人能指出问题,我将不胜感激 :)。default.conf:
server {
listen 80;
server_name example.com;
location /static/ {
root /srv;
}
location / {
proxy_redirect off;
proxy_pass http://unix:/srv/sockets/website.sock;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
这是来自首页的一个表单:
<form id='formone' method='POST' action=''> {% csrf_token %}
{{ form.as_p }}
<br />
<button type="submit" class="btn btn-success btn-sm">Submit</button>
</form>