简体   繁体   English

django和sqlalchemy

[英]django and sqlalchemy

I'm fairly new to Django and have a basic question: I want to use an ORM that I can work with it for Django and other python projects, so the basic question is Django ORM agnostic and if so how can I use SQLAlchemy with it for example? 我是Django的新手并且有一个基本的问题:我想使用一个ORM,我可以用它来处理Django和其他python项目,所以基本的问题是Django ORM不可知,如果是这样的话我怎么能用它来运行SQLAlchemy例如?

If it's not, then what do you suggest for the above problem (using ORM objects that works with both Django and outside it)? 如果不是,那么你对上述问题有什么建议(使用兼容Django和外部的ORM对象)?

Option 1: Use the Django ORM for other projects. 选项1:将Django ORM用于其他项目。 Using only the DB part of Django 仅使用Django的DB部分

This works well. 这很好用。 I prefer it. 我更喜欢它。

Option 2: Use SQLAlchemy with Django. 选项2:将SQLAlchemy与Django一起使用。 SQLAlchemy and django, is it production ready? SQLAlchemy和django,生产准备好了吗? and Configuring Django to use SQLAlchemy 配置Django以使用SQLAlchemy

This works well, also. 这也很有效。 I don't prefer it because I don't like reconfiguring Django. 我不喜欢它,因为我不喜欢重新配置Django。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM