--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.'))