gpt4 book ai didi

python - NotAllowedError create_login_url

转载 作者:太空宇宙 更新时间:2023-11-04 02:05:45 24 4
gpt4 key购买 nike

更新3

无奈之下,我创建了一个新的google appengine应用,该应用与原始应用相同,即使名称相同,但ID稍长。新应用程序具有-232619 added to the ID,原始应用程序具有简要信息ID。新应用程序可以按预期工作,但原始应用程序仍会产生NotAllowedError。

因此,根据我的判断,问题出在Google的系统中,但是我无法让Google的任何人为我提供解决方案,使我能够保留该应用程序的原始ID。似乎管理员必须删除我原来的名为Participoll的应用程序,但以某种方式让我替换了它。替换它会很复杂,因为应用程序创建系统还必须删除名称Participoll足够长时间,以便我可以再次声明应用程序名称/ ID。

因此,我在2个gae地方拥有相同的应用,两者的项目名称完全相同,但项目ID略有不同。具有愚蠢ID的应用程序可以运行,但是没有人可以帮助我使具有所需ID的应用程序运行。如何解决?我无法删除具有所需ID的应用,因为我会丢失所需名称。

Google有人可以在这里提供帮助吗?

更新3

更新2

Chrome与Firefox产生的结果不同。

participoll.appspot.com在Chrome上生成ApplicationError: 2,在Safari和Firefox上生成Error: Server Error (500)

participoll.appspot.com/admin在Chrome上生成You are an administrator.,在Safari和Firefox上生成You are not logged in.

因此,似乎所有3个人都以为我是管理员。但是,这三个人都没有要求我登录,而且除了在Google App Engine附带的Chrome中,我不知道如何强制注销或登录请求。

这会给任何人更多的想法吗?

更新2

更新1

最近,使用“经过修订的”简单应用程序,我收到了另一条更具描述性的错误消息,如下所示。新错误是指create_logout_url而不是create_login_url,并且500错误已消失。

由于原始的500 error出现了-并没有因为我键入错误而消失,所以我暂时注释掉了登录请求并分配了login_url = 'login_url'logout_url = 'logout_url';也许这使500 error消失了。这是令人鼓舞的,因为500 error的信息不足。因此,也许这种变化暂时解决了其他问题。但是现在我收到了这个新错误。 (但是请参阅下文,因为Safari浏览器仍然具有500 error。)

    ApplicationError: 2 
Traceback (most recent call last):
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~participoll/1.418713147155852221/main.py", line 33, in get
logout_url = users.create_logout_url('/')
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/1/google/appengine/api/users.py", line 299, in create_logout_url
raise e
ApplicationError: ApplicationError: 2

Traceback (most recent call last):
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 273, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~participoll/1.418713147155852221/main.py", line 33, in get
logout_url = users.create_logout_url('/')
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/1/google/appengine/api/users.py", line 299, in create_logout_url
raise e
ApplicationError: ApplicationError: 2


当我要求Chrome提供有关其“不安全”通知的更多信息时,它告诉我正在使用1个cookie。

等待上面的“我的评论”指的是使用Chrome。我刚刚尝试使用Safari,而我只得到了 500 error

更新1

更新0

服务器错误异常为500(我最初并没有这么说)。
即使将应用程序的勇气更改为仅包含Google提供的示例代码,也会发生相同的服务器错误异常:500。

从来没有将此应用程序从主/从数据存储区迁移到HRD数据存储区(因为未告知开发人员这样做的必要性)。
我怀疑该应用程序已被冻结,原因是迁移尚未完成,但Answerer对此表示反对(请参阅对Answer的评论)。

修改后的app.yaml:

application: participoll
version: 1
runtime: python27
threadsafe: yes
api_version: 1

handlers:
- url: .*
script: main.app


修改后的main.py:

# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Sample Google App Engine application that demonstrates using the Users API

For more information about App Engine, see README.md under /appengine.
"""

# [START all]

from google.appengine.api import users
import webapp2


class MainPage(webapp2.RequestHandler):
def get(self):
# [START user_details]
user = users.get_current_user()
if user:
nickname = user.nickname()
logout_url = users.create_logout_url('/')
greeting = 'Welcome, {}! (<a href="{}">sign out</a>)'.format(
nickname, logout_url)
else:
login_url = users.create_login_url('/')
greeting = '<a href="{}">Sign in</a>'.format(login_url)
# [END user_details]
self.response.write(
'<html><body>{}</body></html>'.format(greeting))


class AdminPage(webapp2.RequestHandler):
def get(self):
user = users.get_current_user()
if user:
if users.is_current_user_admin():
self.response.write('You are an administrator.')
else:
self.response.write('You are not an administrator.')
else:
self.response.write('You are not logged in.')


app = webapp2.WSGIApplication([
('/', MainPage),
('/admin', AdminPage)
], debug=True)

# [END all]


我的目标是为该应用程序保留ParticiPoll的名称,无论数据存储区是保留还是未保留。我该如何进行?例如,在开发人员的Google Cloud Platform上是否有一些信息可用于确认数据存储状态或进行编辑以避免服务器错误?

以上更新0

我的应用程序可在本地服务器上运行,但不能在公共服务器上运行。这向我表明我的app.yaml存在问题,但是我没有发现问题的运气。

app.yaml:

application: participoll
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /static
static_dir: static

- url: /favicon.ico
static_files: static/images/favicon.ico
upload: static/images/favicon.ico

- url: /.*
script: main.app

libraries:
- name: jinja2
version: "2.6"
- name: markupsafe
version: latest

builtins:
- remote_api: on


main.py

import webapp2
from views import MainHandler, TablePage, AddPerson, AddQuestion, Image
import os

app = webapp2.WSGIApplication([
('/', MainHandler),
('/table', TablePage),
('/add_person', AddPerson),
('/add_question', AddQuestion),
('/img', Image),
],
debug=True)


views.py(摘录)(注意users.create_login_url(self.request.uri))

class MainHandler(BaseHandler):

def get(self):
ID_id = self.request.get("ID", None)
if ID_id == '':
ID_id = None
user = users.get_current_user()
if ID_id is None: #no ID has been set by the user
path = os.path.join(TEMPLATE_DIR, 'splash.html')
if user: #offer user or nonuser options back at choose_name.html
url = users.create_logout_url(self.request.uri)
url_linktext = 'Signout'
url_linktextmore = ' if you wish. You will be returned to this page after you signout.'
else:
url = users.create_login_url(self.request.uri)
url_linktext = 'Signin'
url_linktextmore = ' if you will be creating a page. You will be returned to this page after you signin.'
template_values = {
'url': url,
'url_linktext': url_linktext,
'url_linktextmore': url_linktextmore,
}
self.response.out.write(template.render(path, template_values))


我可以在检测和修复此异常方面获得帮助吗?

最佳答案

关于python - NotAllowedError create_login_url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54776771/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com