There are many different web frameworks under Python. Django is the most representative of the heavyweight players. Many successful websites and apps are based on Django.

Django is an open source web application framework written in Python.

Django model syntax

Django provides good support for various databases, including: PostgreSQL, MySQL, SQLite, and Oracle.

Django provides a unified calling API for these databases. We can choose different databases according to our business needs.

MySQL is the most commonly used database in web applications. In this chapter we will use Mysql as an example to introduce. You can learn more about the basics of Mysql through the MySQL tutorial on this site.

Django model example

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # 或者使用 mysql.connector.django 'NAME': 'test', 'USER': 'test', 'PASSWORD': 'test123', 'HOST':'localhost', 'PORT':'3306', } }