Now I am trying to develop server using nginx + unicorn + flask.
If I execute python only, csrf_tokens work without any problems.
However, if I execute python using nginx + unicorn + flask, the error occurs.
400 BAD Request - The CSRF session token is missing. or The CSRF tokens do not match.
Is there additional settings that I should have done for nginx for session?
or Did I miss something??
app/init.py
from flask_wtf.csrf import CsrfProtect
csrf = CsrfProtect()
def create_app(config_name):
app = Flask(__name__, instance_path='/instance')
app.config.from_object(config[config_name])
config[config_name].init_app(app)
bootstrap.init_app(app)
moment.init_app(app)
csrf.init_app(app)
app.config.update(CSRF_ENABLED = app.config['CSRF_ENABLED'])
//CSRF_ENABLED = True
return app
login.html
<form action="{{url_for('.login')}}" class="form-signin text-center" method="POST">
{{ form.csrf_token }}
</form>