Django study notes ---- set up database

1. Set Django back-end database

DATABASES property found in the project directory setting in

Databases

Django officially supports the following databases:

There are also a number of database backends provided by third parties.

 

- MySQL connection

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': "数据库名称",
        'USER': "root",
        'PASSWORD': "woailyoo",
        'HOST': "192.168.247.5",
        'PORT': '3306',
        'OPTIONS': {
            "init_command": "SET foreign_key_checks = 0;",
        }
    }
}

- connect to Oracle

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.oracle',
        'NAME': '实例名',
        'USER': 'a_user',
        'PASSWORD': 'a_password',
        'HOST': 'dbprod01ned.mycompany.com',
        'PORT': '1540',
    }
}

 

 

 

Published 35 original articles · won praise 61 · views 160 000 +

Guess you like

Origin blog.csdn.net/woailyoo0000/article/details/103791474