Django MongoDB Engine error when running tellsiteid

后端 未结 9 999
野的像风
野的像风 2021-02-02 04:24

SO I created a django project and app as per the tutorial and I have all the dependencies necessarry for MongoDB Engine it all seemed to be working fine and dandy till I tried e

9条回答
  •  轮回少年
    2021-02-02 04:43

    Most likely you havent created a site yet, to do so you need to run the command

    python manage.py syncdb
    

    This creates the site, now you need to add its site_id in your settings file. Go get the site id, connect to mongodb engine that is running, and run the following commands

    use mydatabase --/# or whatever name you have for your database.
    db.django_site.find()
    

    you will get something like

    ObjectId("4f4e968adea3b3b30c00001d")
    

    then in your settings file, put

    site_id = u'4f4e968adea3b3b30c00001d'
    

    and the admin interface should work. Does it?

提交回复
热议问题