Django admin and MongoDB, possible at all?

前端 未结 7 682
野的像风
野的像风 2021-02-04 03:01

I\'m building a simple short URL service, ala bitly, for our company use. And I would like to use mongodb to store the data, but I will need some kind of simple interface to add

相关标签:
7条回答
  • 2021-02-04 03:36

    I have confirmed that django-nonrel project does support the admin interface. I did have a problem where the default SITE_ID was picked up as a number, which is not allowed as a primary key in MongoDB. I resolved this by setting:

    SITE_ID = '4d421623b0207acdc500001d'

    in my settings.py

    I got the number by printing the id of the first site value in the collection through the shell.

    I have not tested this extensively, but did register an admin for a Poll object and see it work.

    0 讨论(0)
  • 2021-02-04 03:44

    mongodb has many behaviors and django-admin is for relation database like postgresql

    you can create django admin with django-nonrel but its not optimize and good. i think its bettwr you create custom admin for your application.

    0 讨论(0)
  • 2021-02-04 03:47

    I have used django-nonrel with mongodb-engine and it works well. Django admin also works with standard model fields. But if you are using listfield and dictfield, you would need to do some hacking.

    0 讨论(0)
  • 2021-02-04 03:54

    This is an old question but if someone happens to be facing the same problem today, I think his best bet would be http://humongous.io. It's a django-admin like interface for mongoDB. It knows how to guess/deal with relationships and works pretty much as the Django admin.

    0 讨论(0)
  • 2021-02-04 03:56

    Django Admin is VERY MUCH possible with MongoDB. Have you looked into the Djongo project?

    Djongo is a SQL to MongoDB query compiler. It translates every SQL query string into a mongoDB query document. As a result,

    • All Django models and related modules work as is.
    • Use the Django Admin GUI to add MongoDB embedded documents.
    • Djongo provides API extensions to the Django ORM that let you ‘embed’ one document inside another, like MongoEngine.

    There is an article on Using Django with MongoDB by adding just one line of code, if you are looking for more information. Otherwise, you can jump directly into the djongo documentation and start using it.

    0 讨论(0)
  • 2021-02-04 03:57

    I'm not positive, but django-nonrel and the mongodb backend may support the django admin nowadays... it might be worth looking into

    http://www.allbuttonspressed.com/projects/django-nonrel

    0 讨论(0)
提交回复
热议问题