は、GoogleのApp Engineとの.htaccessスタイルのパスワードを模倣することができ、これを試してみてください:
def basicAuth(func):
def callf(webappRequest, *args, **kwargs):
# Parse the header to extract a user/password combo.
# We're expecting something like "Basic XZxgZRTpbjpvcGVuIHYlc4FkZQ=="
auth_header = webappRequest.request.headers.get('Authorization')
if auth_header == None:
webappRequest.response.set_status(401, message="Authorization Required")
webappRequest.response.headers['WWW-Authenticate'] = 'Basic realm="Kalydo School"'
else:
# Isolate the encoded user/passwd and decode it
auth_parts = auth_header.split(' ')
user_pass_parts = base64.b64decode(auth_parts[1]).split(':')
user_arg = user_pass_parts[0]
pass_arg = user_pass_parts[1]
if user_arg != "admin" or pass_arg != "foobar":
webappRequest.response.set_status(401, message="Authorization Required")
webappRequest.response.headers['WWW-Authenticate'] = 'Basic realm="Secure Area"'
# Rendering a 401 Error page is a good way to go...
self.response.out.write(template.render('templates/error/401.html', {}))
else:
return func(webappRequest, *args, **kwargs)
return callf
class AuthTest(webapp.RequestHandler):
@basicAuth
def get(self):
....
How-To: Dynamic WWW-Authentication (.htaccess style) on Google App Engine
app.yamlをで "アクセス権の設定" を使用してオプションのいずれかであるためではありません私は手動で登録された/ログ可能なユーザーにパスワードを送信したい、または私が誰のためにパスワードを選択することもできればクールだ。しかし、とにかく...基本的な考え方は、1つの事前定義されたパスワードでページを保護し、それをユーザーに送信することです。 – Jmlevick