[英]FLASK-python ValueError: View function did not return a response
[英]Python Error ValueError: View function did not return a response
我的應用程序在運行URL http:// localhost:81 / ip_update / 00178r時出現錯誤ValueError:View函數未返回響應。 我無法解決,如果有人可以幫助我,我將非常感謝
def ip_update (client):
ip = request.remote_addr
if 'r' in client:
customer = cliente.rstrip ('r')
urllib2.urlopen ('http://localhost:85/administration/ip_update/' + client + '/' + ip)
time.sleep (3)
else:
server = 'localhost'
port = 3306
login = root
password = 'password'
mdb.connect con = (host = server, port = port = user login, passwd = password, use_unicode = True)
cur = con.cursor ()
cur.execute ("SELECT FROM tar_cliente ebas.tarefa WHERE tar_status = 'processing' and tar_cliente = '" + client $
if cur.rowcount == 0:
Data2 data = ()
server = data2 ['clients'] [customer] ['server']
urllib2.urlopen ('http://' + server + '/administration/ip_update/' + client + '/' + ip)
time.sleep (3)
return 'request for ip received for updating client code' + client
else:
return 'denied updating, client operation underway'
if
測試為true, if
函數返回None
:
if 'r' in client:
customer = cliente.rstrip ('r')
urllib2.urlopen ('http: // localhost: 85 / administration / ip_update /' + client + '/' + ip)
time.sleep (3)
在這種情況下,您也需要返回響應。 這里沒有必要使用睡眠; 您要做的只是延遲將某些內容返回瀏覽器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.