本人使用django创建web项目使用的数据库是sqlite3,python版本为2.5.4,django版本为1.4.5
然后我创建了一个project,配置settings.py文件为
DATABASES = {
'default': {
'ENGINE': [color=red]'sqlite3'[/color], # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': './testDj.db3', # 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.
}
}
确不料报出如下错误
error:no module named base
将配置settings.py文件改为
DATABASES = {
'default': {
'ENGINE':[color=red] 'django.db.backends.sqlite3',[/color] # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': './testDj.db3', # 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.
}
}
可以正常运行
然后我创建了一个project,配置settings.py文件为
DATABASES = {
'default': {
'ENGINE': [color=red]'sqlite3'[/color], # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': './testDj.db3', # 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.
}
}
确不料报出如下错误
error:no module named base
将配置settings.py文件改为
DATABASES = {
'default': {
'ENGINE':[color=red] 'django.db.backends.sqlite3',[/color] # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': './testDj.db3', # 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.
}
}
可以正常运行