Site matching query does not exist

前端 未结 7 1441
小蘑菇
小蘑菇 2020-11-27 13:27

Python noob, as in this is my first project, so excuse my unfamiliarity.

The site was working very well until I clicked \"log out\" on my app. After that, the websit

7条回答
  •  孤独总比滥情好
    2020-11-27 13:59

    I see answers to create a new site and reference id for that. But if you already have a site or somehow you deleted and created the site again from UI then the id keeps on incrementing. To solve this you can get the id as follows:

    python manage.py shell
    from django.contrib.sites.models import Site
    print(Site.objects.get(name='example.com').id)
    

    Get the id you get here into setting.py . Eg.

    SITE_ID = 8
    

    Basically ID in table corresponding yo tour site and in the settings.py should match.

提交回复
热议问题