孙爱荣吧,豆影网,浩方注册账号
django快速配置多种数据库
$ pip install dj-database-url
settings.py
from DATABASE_URL
:import dj_database_url DATABASES = { 'default': dj_database_url.config(default="postgres:///channels-example", conn_max_age=500) }
Engine | Django Backend | URL |
---|---|---|
PostgreSQL | django.db.backends.postgresql_psycopg2 | postgres://USER:PASSWORD@HOST:PORT/NAME |
MySQL | django.db.backends.mysql | mysql://USER:PASSWORD@HOST:PORT/NAME?init_command=SET sql_mode=STRICT_TRANS_TABLES |
SQLite | django.db.backends.sqlite3 | sqlite:////full/path/to/your/database/file.sqlite |
... | ... | ... |
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
新手学习Python2和Python3中print不同的用法
Python基于os.environ从windows获取环境变量
网友评论