django之sqlite3常见错误

2020-01-14 16:01:02 浏览数 (1)

如果错误的最后一行是

django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3

则可以试一下命令

wget http://pysqlite.googlecode.com/files/pysqlite-2.6.3.tar.gz tar -xzf pysqlite-2.6.3.tar.gz

cd pysqlite python setup.py build_static install

如果打名令python manage.py syncdb 之后还有错误那么可以试一下下面的操作

将setting 中的 DATABASES改成如下

DATABASES = {     'default': {         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '/home/sunbaigui/db.sqlite',  (注意这个后缀名一定要写对)                    # Or path to database file if using sqlite3.         'USER': '',                      # Not used with sqlite3.         'PASSWORD': '',                  # Not used with sqlite3.         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.     } }

这些是我遇到的问题,仅供参考

0 人点赞