Configuring Django

前端 未结 2 1749
盖世英雄少女心
盖世英雄少女心 2021-02-14 09:33

I just installed Django 1.6 on OS X 10.8 with python 2.7 and am having trouble going through the tutorial. After setting creating a server called mysite by running:



        
相关标签:
2条回答
  • 2021-02-14 09:52

    Ok so I finally found the answer. Apparently the error was a result of Python 2.7.2. Once I upgraded to 2.7.6, the problem went away.

    Here is a similar thread where I found the answer:

    maximum recursion depth exceeded in cmp error while executing python manage.py runserver

    Don't know why this solution didn't show up in my searches when I was creating this thread...

    0 讨论(0)
  • 2021-02-14 10:03

    Check in manage.py if you have this:

    import os
    
    if __name__ == "__main__":
        os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
    

    And in wsgi.py this:

    import os
    
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
    

    Also, any python scripts that integrate Django should look like this:

    import os
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
    # Uncomment below for Django 1.7 +
    #import django
    #django.setup()
    
    0 讨论(0)
提交回复
热议问题