@app.route('/', methods=['GET', 'POST'])
def login():
if request.method == 'GET':
if 'USER_TOKEN' in session:
return make_response(render_template('index.html'))
return make_response(render_template('login.html'))
if request.method == 'POST':
print 'data :', request.form
return make_response(render_template('index.html'))
我HTML
是瓶接收沒有數據的HTML POST
<form class="form-horizontal" action="/" method="POST">
<div class="control-group">
<label class="control-label" for="email">Email</label>
<div class="controls">
<input type="text" id="email" placeholder="Email">
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Password</label>
<div class="controls">
<input type="password" id="password" placeholder="Password">
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Sign In</button>
</div>
</div>
</form>
當我從HTML頁面提交的數據,我看到
data : ImmutableMultiDict([])
爲什麼數據丟失?
我相信這是習慣性地在在輸入中包含'name'屬性的形式;) – Andbdrew 2013-04-23 04:46:53