Django Nonrel - Can't log into Admin Panel on development server

柔情痞子 提交于 2019-12-11 07:22:31

问题


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.

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?


回答1:


UPDATE - turn off the server, run python2.5 manage.py syncdb, and add a fresh superuser. Must already have included django.contrib.admin to INSTALLED_APPS

This is not at all the answer. Completely different symptoms. I will try to remember to post here when I figure it out.




回答2:


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()

and run

python manage.py syncdb

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


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 !")

and and the corresponding entry in urls.py file.

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

enter the

localhost:8080/stop/ 

each time you want to flush the datastore to file



来源:https://stackoverflow.com/questions/4108214/django-nonrel-cant-log-into-admin-panel-on-development-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!