Django: Using Databases
摘要
As we learned earlier in this book, Django’s ORM API is one of its standout features with which the database interaction becomes much more Pythonic, rather than having to execute raw SQL queries. However, it is too tightly coupled with the other features of the Django framework – such as the migrations, the admin interface, and more. There are other ORM libraries for Python, notably SQLAlchemy, SQLObject, etc., which are far more flexible. SQLAlchemy offers support for a wider range of databases and works well with other frameworks like Flask. Hence, if someone wants to port a Flask application to Django, is it possible to use SQLAlchemy with Django, and if yes, how? We shall find an answer to this in this chapter.