Getting Site Matching Query Does Not Exist Error a

2019-01-16 09:06发布

I'm going through the standard Django tutorial to create an admin for an app. After commenting the admin related stuff in settings and running syncdb I'm getting this message:

DoesNotExist at /admin/ Site matching query does not exist.

Can anyone help me figure this out?

9条回答
趁早两清
2楼-- · 2019-01-16 09:40

Sometimes if you add more Sites via Admin and delete some of them each site has an ID, it was not working for me once I changed the ID in the DB it started working, so make sure SITE_ID matches the ID in the database.

查看更多
疯言疯语
3楼-- · 2019-01-16 09:41

In addition to Simeon Visser's answer for those of you still experiencing problems, make sure the SITE_ID variable in your settings matches the ID of your newly created Site-object.

查看更多
看我几分像从前
4楼-- · 2019-01-16 09:45

If you use South and initial_data fixtures, data could be loaded not properly. To fix it add

if 'test' in sys.argv or 'jenkins' in sys.argv:
    SOUTH_TESTS_MIGRATE = False

at the end of your settings file

查看更多
登录 后发表回答