Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法登录到Django Unrel中的管理界面_Python_Django_Google App Engine - Fatal编程技术网

Python 无法登录到Django Unrel中的管理界面

Python 无法登录到Django Unrel中的管理界面,python,django,google-app-engine,Python,Django,Google App Engine,作为普通人,我无法登录到Django(Nonrel)管理界面,其他用户提供的解决方案在我的情况下也不起作用。我正在运行Python 2.7和Google App Engine 1.6.0 让我看看。我的URL.py中有以下内容: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^$', 'django.views.generic.simple.direct_to_tem

作为普通人,我无法登录到Django(Nonrel)管理界面,其他用户提供的解决方案在我的情况下也不起作用。我正在运行Python 2.7和Google App Engine 1.6.0

让我看看。我的URL.py中有以下内容:

from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
    (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'home.html'}),
    url(r'^admin/', include(admin.site.urls)),
)
这在settings.py中

MIDDLEWARE_CLASSES = (
    'mediagenerator.middleware.MediaMiddleware',
    # This loads the index definitions, so it has to come first
    'autoload.middleware.AutoloadMiddleware',
    # Media middleware has to come first

    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
)

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.contenttypes',
    'django.contrib.auth',
    'django.contrib.sessions',
    'djangotoolbox',
    'autoload',
    'dbindexer',
    'mediagenerator',

    # djangoappengine should come last, so it can override a few manage.py commands
    'djangoappengine',
)
我在取消注释'django.contrib.admin'后创建了一个超级用户,但它不起作用。我手动创建了另一个超级用户(通过python manage.py createsuperuser),这也不起作用。然而,奇怪的是,这些超级用户是可用的:

python manage.py shell
>>> from django.contrib.auth.models import User
>>> User.objects.all()
[<User: robert>, <User: john>]
>>> User.objects.all()[0].is_staff
True
>>> User.objects.all()[0].is_superuser
True
有什么建议吗

顺便说一句,正如David Poblador在本文中建议的那样,我创建了没有运行服务器的超级用户

更新:我尝试部署(python manage.py deploy),但情况完全相同。我无法使用任何超级用户登录,尽管除此之外,没有错误

更新2:我读到一条建议查看/u ah/admin的帖子,但我不确定该怎么做。我有
auth_user
\u AhAdminXsrfToken
django_session
,在数据存储查看器的“实体种类”字段中有两个“表”。当我选择auth_user时,我会得到以下消息“数据存储在空名称空间中不包含“auth_user”类型的实体”

更新3:好吧,现在我正式感到困惑。我创建了另一个项目,只添加了
中间件类
自动发现
django.contrib.admin
来启用管理界面。它加载“It works”页面,但我得到了一个例外。加载
localhost/admin
时也会发生同样的情况。同样,在查询了
User.objects.all()
之后,我得到了超级用户的正确列表,但它们在登录页面中不起作用

提前谢谢


问候

好的。我部分解决了这个问题

我再次从下载了每个文件,但是这次我使用了克隆链接,而不是直接的zip文件(具有/get/tip.zip的文件)。我修改了settings.py和url.py以启用管理

之后,我可以登录到管理界面。尽管如此,当我启动一个请求(任何请求)时,我会得到上述相同的异常。这仍有待解决

Exception happened during processing of request from ('127.0.0.1', 55568)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 2438, in __init__
    BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 641, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 694, in finish
    self.wfile.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe