运行 python manage.py syncdb 报错:
django.core.exceptions.ImproperlyConfigured: 'sqlite3' isn't an available database backend.
Try using django.db.backends.sqlite3 instead.Error was: No module named base
我特意看了一眼装没装sqlite3:
sqlite3 -version
一看还真有:
3.7.7 2011-06-25 16:35:41 8f8b373eed7052e6e93c1805fc1effcf1db09366
然后再仔细看报错,怀疑可能是 Django1.4 里面settings简写sqlite3不行,好像得写全django.db.backends.sqlite3。于是改了一下settings.py :
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',# Add 'postgresql_psycopg2','@R_301_198@','sqlite3' or 'oracle'.
'NAME': '/opt/test.db',# 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.
}
}