加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

sqlite是否捆绑到Django中?

发布时间:2020-12-12 18:52:47 所属栏目:百科 来源:网络整理
导读:Django是捆绑sqlite还是单独的模块? 无法弄清楚这一点,即使是通过查看Django来源: https://code.djangoproject.com/browser/django/trunk/django/db/backends/sqlite3 解决方法 你在找这个: 21 try:22 try:23 from pysqlite2 import dbapi2 as Database24
Django是捆绑sqlite还是单独的模块?

无法弄清楚这一点,即使是通过查看Django来源:
https://code.djangoproject.com/browser/django/trunk/django/db/backends/sqlite3

解决方法

你在找这个:

21  try:
22      try:
23          from pysqlite2 import dbapi2 as Database
24      except ImportError,e1:
25          from sqlite3 import dbapi2 as Database
26  except ImportError,exc:
27      from django.core.exceptions import ImproperlyConfigured
28      raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)

它首先尝试导入PySqlite,一个外部模块.如果失败,它会尝试导入Python 2.5中包含的sqlite3模块.如果既没有安装Python 2.5也没有安装外部模块,则失败.它不包括自己的副本.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读