我正在尝试从其自己的视图之一向我的Flask应用发送发布请求,但该请求一直挂起,直到我杀死服务器为止。如果我使用JavaScript进行请求,则效果很好。为什么它不能在Python代码中工作?from flask import Blueprint, render_template, abort, request, Response, session, url_forfrom jinja2 import TemplateNotFoundfrom flask.ext.wtf import Formfrom wtforms import BooleanField, TextField, PasswordFieldimport requestslogin = Blueprint('login', __name__, template_folder='templates')class LoginForm(Form): email = TextField('Email') password = PasswordField('Password')@login.route('/login', methods=['GET', 'POST']) def _login(): form = LoginForm(request.form, csrf_enabled=False) if form.validate_on_submit(): return requests.post(request.url_root + '/api/login', data={"test": True}) return render_template('login.html', form=form)
添加回答
举报
0/150
提交
取消