AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'

前端 未结 2 959
耶瑟儿~
耶瑟儿~ 2020-12-11 00:17

Following on from my last question Error: No module named psycopg2.extensions, I have updated my mac OS to Mountain Lion and installed Xcode. I have also installed psycopg2

2条回答
  •  执笔经年
    2020-12-11 00:59

    If you're working on a Django project, the root of your project(ROOT_URLCONF= variable) isn't defined in your settings.py file, or at least it isn't defined properly.

    If you don't have a settings.py file, this block of code should fix the issue:

    from django.conf import settings
    
    settings.configure(
    # ...
        ROOT_URLCONF=__name__,
    # ...
        ),
    )
    

    What that does is specify the root of your project runserver knows where to find your project.

    If do have a settings.py file, then find that variable and add __name__ to it.

提交回复
热议问题