是什么会使Flask-WTForms对每个字段都返回None?

时间:2019-02-18 09:13:36

标签: flask flask-wtforms python-3.7 quart

我有几种形式,可以在本地运行该应用程序时按预期工作。

但是,当我尝试在通过nginx代理的同一应用程序上使用任何表单时,每种表单都会为每个字段返回None

如果我打印form.data,它将返回:

{'display_name': None, 'password': None, 'csrf_token': None}

浏览器将表单数据/过帐请求数据显示为:

csrf_token: <an actual and matching csrf token>
display_name: jack
password: <the_actual_password>
remember_me: on
submit: Login

nginx配置的相关部分:

upstream quart_app {
    server 10.217.0.130:8651;
}

server {
    server_name          quart_app.url; # This is a proper url normally
    listen               443 ssl http2;
    listen               [::]:443 ssl http2;

    ssl_certificate      /etc/letsencrypt/live/quart_app/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/quart_app/privkey.pem;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_stapling on;
    ssl_stapling_verify on;

    add_header           "Strict-Transport-Security" "max-age=15768000";

    access_log           logs/quart_app.access.log main;

    location / {
        proxy_pass             https://quart_app;
        proxy_set_header       Host $host;
        proxy_set_header       X-Real-IP $remote_addr;
        proxy_set_header       'Upgrade' $http_upgrade;
        proxy_set_header       'Connection' 'upgrade';
        proxy_set_header       'Content-Type' 'text/plain; charset=utf-8';
        proxy_set_header       'Accept-Encoding' 'br';
        proxy_set_header       'Service-Worker-Allowed' '/';
        proxy_set_header       'Pragma' 'public';
        proxy_set_header       'Cache-Control' 'public';
        proxy_set_header       'Vary' 'Accept-Encoding';

    }

}

我知道这与我的Quart代码本身无关,因为它是与在本地使用开发服务器时正常工作的相同代码(git克隆)。

可能导致这种情况发生的原因。

0 个答案:

没有答案