推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
tu7jako
V2EX  ›  Python

请问 django 如何连接 mongo,并且能使用 django 自带的 admin??

  •  
  •   tu7jako · Feb 16, 2021 · 2939 views
    This topic created in 2047 days ago, the information mentioned may be changed or developed.

    我只知道 django 自带的 orm 能较好的连接关系型数据库,如 mysql 等····现在得用 django+mongo,最好还能使用上 django 的 admin

    3 replies  •  2021-02-18 10:57:09 +08:00
    aristolochic
        1
    aristolochic  
       Feb 16, 2021
    印象里 Django Admin 还有其他的 contrib 是不会对数据库是关系型还是什么作出限制的吧,一般只会依赖 ORM
    那就好办了,找找 MongoDB 的 Django Driver
    我找到一个,叫 Djongo
    但这么整真的有优势嘛?无非就是不用 migrate 了呗,剩下还不如 RDBMS 呢
    ezioruan
        2
    ezioruan  
       Feb 17, 2021
    Djongo 是唯一的方案可以完美使用 admin
    我有实际的项目使用 只是用他来快速构建 Django admin
    基本的 crud 没有问题

    但是在多数据库使用的时候有时候主外键关联会丢失导致找不到数据
    如果只是一个库使用就没什么问题
    xpresslink
        3
    xpresslink  
       Feb 18, 2021
    pip install djongo
    https://github.com/videntity/django-djmongo
    两三年前有项目中用过一次。基本上可以直接使用 ORM
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2559 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:04 · PVG 18:04 · LAX 03:04 · JFK 06:04
    ♥ Do have faith in what you're doing.