Django Nonrel - 无法登录到开发服务器上的管理面板 [英] Django Nonrel - Can't log into Admin Panel on development server

查看:97
本文介绍了Django Nonrel - 无法登录到开发服务器上的管理面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个奇怪的位。我为我的应用程序创建了一个用于django管理员的超级用户,这只是一个新的django nonrel项目,启用了管理员。我在运行开发服务器时尝试访问/ admin,但是当我输入(正确的)用户名和密码时,它告诉我不正确。

Bit of a strange one. I've created a super user for django admin for my app, which is just a new django nonrel project with admin enabled. I try and access the /admin whilst running the development server, but when I type in the (correct) username and password it tells me they are not correct.

部署项目到Google App Engine,登录工作正常。为什么Googles服务器可以正常工作,但不在开发服务器上?

Deploying the project to Google App Engine, the login works fine. Why would it work fine on Googles servers, but not on the development server?

推荐答案

我有一个在Windows中工作的解决方法vista

I have a workaround that is working in windows vista

#change the manage.py code to:
if __name__ == "__main__":

 print "lets go...."

    execute_manager(settings)


    import os

    from google.appengine.tools import dev_appserver
    #from view.PresetsPage import DuplicatePresetGroup
    print "flushing database ..."
    dev_appserver.TearDownStubs()

并运行

python manage.py syncdb

毕竟您应该可以在磁盘上找到数据存储文件。

after all you should be able to find the 'datastore' file on your disk.

在views.py add:

in views.py add:

def stopAll (request):
    import os
    if os.environ.get('SERVER_SOFTWARE','').startswith('Development'):
        from google.appengine.tools import dev_appserver

        dev_appserver.TearDownStubs()
    return HttpResponse("completed !")

和urls.py文件中的相应条目。

and and the corresponding entry in urls.py file.

(r'^stop/$', stopAll),

输入

localhost:8080/stop/ 

时间您要刷新数据存储到文件

each time you want to flush the datastore to file

这篇关于Django Nonrel - 无法登录到开发服务器上的管理面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆