【发布时间】:2015-09-26 20:22:47
【问题描述】:
我的应用程序在运行 url http://localhost:81/ip_update/00178r 时出现错误 ValueError: View function did not return a response。 我无法解决,如果有人能帮助我,我将不胜感激
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'
【问题讨论】:
-
您在哪一行得到错误?你能发布完整的回溯吗?
-
您发送给
urlopen()的值不能在URL中包含空格;我已经删除了它们,前提是 Stack Overflow 告诉您不能在文本中包含此类 URL。它们在代码块中很好。 -
你能再清理一下代码吗?例如,您的
Data2 data = ()行不是有效的 Python。您发布的代码不可能运行。