First, sqlite3 use 1, import sqlite3 confirm whether the system installed 2, into the current project directory, cmd run python, into the command line mode 3, Import sqlite3, sqlite3.connect (' {path\name.db} ') #大括号内表示自定义, real case No curly braces 4, modify settings.py file DATABASES = { ' Default ': { ' ENGINE ': ' django.db.backends.sqlite3 ', ' NAME ' : {path\name.db} ', ' USER ': ', ' PASSWORD ': ', ' HOST ': ', ' PORT ': ', }}5, enter the database file interface , Run python manage.py shell from django.db import connection cur = connection.cursor () If there is no error, the configuration is successful 6, modify the models.py file, configure your own table Example: from django.db import models from django.contrib import admin # create your models here. class blogpost (models. Model): title = models. Charfield (max_length = 150) body = models. TextField () timestamp = models. Datetimefield () class meta: ordering = ['- Timestamp ']7, create database content python manage.py syncdb Enter as prompted, Indicates a successful connection note: The above only represents the creation, connection and use of the database, and does not contain any other content. Second, MYSQL1, confirm the installation of MySQL database 2, in MySQL CREATE database command mode can use CREATE DATABASE {name} Default charset=utf8;3, modify settings.py file DATABASES = { ' Default ': { ' ENGINE ': ' Django.db.backends.mysql ', ' name ': ' {name} ', ' USER ': ' {username} ', ' PASSWORD ': ' {PASSWORD} ', ' HOST ': ' localhost ', #ip ' PORT ': ' 3306 ', } }4, Modify the models.py file, configure your own tables for example: from django.db import models from django.contrib import admin # create your models here. class blogpost (models. Model): title = models. Charfield (max_length = 150) body = models. TextField () timestamp = models. Datetimefield () class meta: ordering = ['- Timestamp '] 5, CREATE database content python manage.py syncdb Follow the prompts to enter, indicating a successful connection