同时连接Mysql、Mongodb
# 在settings.py文件中编辑如下
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'pule_decision',
'PORT': '3306',
'HOST': '127.0.0.1',
'USER': 'root',
'PASSWORD': 'password',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4"
},
},
'mongodb': {
'ENGINA': None,
}
}
from mongoengine import connect
connect('mongodbname', host='127.0.0.1', port=27017)