我正在尝试使用控制台中的参数来使用 --auth_local_webserver、--auth_host_port,这些是从 OAUTH2 获取凭据所必需的,但我无法使其工作
我以这种方式使用控制台 python google\dev_appserver.py --auth_local_webserver=localhost --auth_host_port project/
我的目录是这个 Project/app.main Project/Handlers/VideoTesting
VideoTesting 是我用来处理 gflags 的那个,我真的不太了解这个,我读了很多,
if FLAGS.auth_local_webserver:
success = False
port_number = 0
for port in FLAGS.auth_host_port:
port_number = port
debug.response.write(str(port_number))
try:
httpd = ClientRedirectServer((FLAGS.auth_host_name, port),
ClientRedirectHandler)
debug.response.write('what')
except socket.error, e:
pass
else:
success = True
break
FLAGS.auth_local_webserver = success
if FLAGS.auth_local_webserver:
oauth_callback = 'http://%s:%s/' % (FLAGS.auth_host_name, port_number)
else:
oauth_callback = 'oob'
authorize_url = flow.step1_get_authorize_url(oauth_callback)
FLAGS = gflags.FLAGS
gflags.DEFINE_boolean('auth_local_webserver', True,
('Run a local web server to handle redirects during '
'OAuth authorization.'))
gflags.DEFINE_string('auth_host_name', 'localhost',
('Host name to use when running a local web server to '
'handle redirects during OAuth authorization.'))
gflags.DEFINE_multi_int('auth_host_port', [8080, 8090],
('Port to use when running a local web server to '
'handle redirects during OAuth authorization.'))