首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

python 与sqlite3的小疑点

2012-04-11 
python 与sqlite3的小问题编辑下面sql语句 向sqlite数据库djangopro.db3中加数据的时候在sqlite manager中

python 与sqlite3的小问题
编辑下面sql语句 向sqlite数据库djangopro.db3中加数据的时候
在sqlite manager中执行下面的语句:

SQL code
insert into Users_users(id, username, password, realname, sex, email)values(1,  'maxiangling', 'mmaa', '马向林', '女', 'aaaa@126.com')insert into Users_users(id, username, password, realname, sex, email)values(2,  'wanglili', 'kfads', '王丽丽', '女', 'wwwlili@126.com')insert into Users_users(id,  username, password, realname, sex, email)values(3, 'gouli', 'guoli', '果里', '男', 'guoli@126.com')


提示:
Internal Error
 near "insert":syntax error

是这方法不对还是哪里有错?
如果没有数据。


我直接打开页面出现下面的错语:

Python code
TemplateDoesNotExist at /users/index.htmlRequest Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.3.1 Exception Type: TemplateDoesNotExist Exception Value: users/index.html Exception Location: F:\Python27\lib\site-packages\django\template\loader.py in find_template, line 138 Python Executable: F:\Python27\python.exe Python Version: 2.7.2 Python Path: ['F:\\Python27\\Django-1.3.1\\Django-1.3.1dasf\\django\\bin\\Django_Pro', 'F:\\Python27\\Lib\\site-packages\\wx-2.8-msw-unicode\\wxPython', 'C:\\WINDOWS\\system32\\python27.zip', 'F:\\Python27\\DLLs', 'F:\\Python27\\lib', 'F:\\Python27\\lib\\plat-win', 'F:\\Python27\\lib\\lib-tk', 'F:\\Python27', 'F:\\Python27\\lib\\site-packages', 'F:\\Python27\\lib\\site-packages\\win32', 'F:\\Python27\\lib\\site-packages\\win32\\lib', 'F:\\Python27\\lib\\site-packages\\Pythonwin', 'F:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode'] Server time: Thu, 15 Mar 2012 00:26:16 +0800 Template-loader postmortemDjango tried loading these templates, in this order:Using loader django.template.loaders.filesystem.Loader: f:\python27\django-1.3.1\django-1.3.1dasf\django\bin\django_pro\templates\users\index.html (File does not exist)Using loader django.template.loaders.app_directories.Loader: Traceback Switch to copy-and-paste viewF:\Python27\lib\site-packages\django\core\handlers\base.py in get_response                     for middleware_method in self._view_middleware:                        response = middleware_method(request, callback, callback_args, callback_kwargs)                        if response:                            break                if response is None:                    try:                        response = callback(request, *callback_args, **callback_kwargs) ...                    except Exception, e:                        # If the view raised an exception, run it through exception                        # middleware, and if the exception middleware returns a                        # response, use that. Otherwise, reraise the exception.                        for middleware_method in self._exception_middleware:                            response = middleware_method(request, e)? Local vars Variable Value exceptions <module 'django.core.exceptions' from 'F:\Python27\lib\site-packages\django\core\exceptions.pyc'> e TemplateDoesNotExist('users/index.html',) callback_args () receivers [(<function _rollback_on_exception at 0x01EB88F0>, None)] middleware_method <bound method CsrfViewMiddleware.process_view of <django.middleware.csrf.CsrfViewMiddleware object at 0x01FE63D0>> self <django.core.handlers.wsgi.WSGIHandler object at 0x01F96A30> settings <django.conf.LazySettings object at 0x00D2C530> request <WSGIRequestGET:<QueryDict: {}>,POST:<QueryDict: {}>,COOKIES:{'Hm_lvt_786fd821ce6c6cdef15bef8fc15750f0': '1323184293406', 'S9Tc_2132_smile': '1D1', 'S9Tc_2132_ulastactivity': '3e951b5b3OaVmYG8dGhSZxw%2FlY5XnFb3%2Fqx3%2F3N68HAgHarDM0pR', 'cnzz_eid': '704592-1318220328-http%3A//127.0.0.1/dede/makehtml_homepage.php', 'kGT7_2132_home_readfeed': '1319125288', 'kGT7_2132_smile': '1D1', 'kGT7_2132_ulastactivity': '8298veTBwBiSKpPx9nzZujByZDF0udOK8eaiAxvdewUn2C1JLllD', 'ltime': '1319780151125', 'rtime': '5'},META:{'1830B7BD-F7A3-4C4D-989B-C004DE465EDE': '1018:163778', 'ALLUSERSPROFILE': 'C:\\Documents and Settings\\All Users', 'APPDATA': 'C:\\Documents and Settings\\Administrator\\Application Data', 'CLIENTNAME': 'Console', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'COMPUTERNAME': '4DD4684509B1479', 'COMSPEC': 'C:\\WINDOWS\\system32\\cmd.exe', 'CONTENT_LENGTH': '', 'CONTENT_TYPE': 'text/plain', 'CSRF_COOKIE': 'f6446ce17f9086d23571cf7d2ae7db96', 'DJANGO_SETTINGS_MODULE': 'Django_Pro.settings', 'FP_NO_HOST_CHECK': 'NO', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HOMEDRIVE': 'C:', 'HOMEPATH': '\\Documents and Settings\\Administrator', 'HTTP_ACCEPT': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'zh-cn', 'HTTP_CONNECTION': 'Keep-Alive', 'HTTP_COOKIE': 'rtime=5; ltime=1319780151125; cnzz_eid=704592-1318220328-http%3A//127.0.0.1/dede/makehtml_homepage.php; kGT7_2132_ulastactivity=8298veTBwBiSKpPx9nzZujByZDF0udOK8eaiAxvdewUn2C1JLllD; kGT7_2132_smile=1D1; kGT7_2132_home_readfeed=1319125288; S9Tc_2132_ulastactivity=3e951b5b3OaVmYG8dGhSZxw%2FlY5XnFb3%2Fqx3%2F3N68HAgHarDM0pR; S9Tc_2132_smile=1D1; Hm_lvt_786fd821ce6c6cdef15bef8fc15750f0=1323184293406', 'HTTP_HOST': '127.0.0.1:8000', 'HTTP_UA_CPU': 'x86', 'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)', 'INCLUDE': 'F:\\VC98\\atl\\include;F:\\VC98\\mfc\\include;F:\\VC98\\include', 'LIB': 'F:\\VC98\\mfc\\lib;F:\\VC98\\lib', 'LOGONSERVER': '\\\\4DD4684509B1479', 'MSDEVDIR': 'F:\\vc6\\MSDev98', 'NUMBER_OF_PROCESSORS': '2', 'OS': 'Windows_NT', 'PATH': 'C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program Files\\Common Files\\Thunder Network\\KanKan\\Codecs;c:\\Program Files\\Microsoft SQL Server\\90\\Tools\\binn\\;F:\\python27;F:\\vc6\\Tools\\WinNT;F:\\vc6\\MSDev98\\Bin;F:\\vc6\\Tools;F:\\VC98\\bin;C:\\Program Files\\SSH Communications Security\\SSH Secure Shell;F:\\Python27\\Lib\\site-packages\\django\\bin', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH', 'PATH_INFO': u'/', 'PROCESSOR_ARCHITECTURE': 'x86', 'PROCESSOR_IDENTIFIER': 'x86 Family 6 Model 15 Stepping 2, GenuineIntel', 'PROCESSOR_LEVEL': '6', 'PROCESSOR_REVISION': '0f02', 'PROGRAMFILES': 'C:\\Program Files', 'PROMPT': '$P$G', 'PYTHONPATH': 'F:\\Python27\\Lib\\site-packages\\wx-2.8-msw-unicode\\wxPython', 'PYTHONSTARTUP': 'F:\\python27\\too.py', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST': '', 'REQUEST_METHOD': 'GET', 'RUN_MAIN': 'true', 'SCRIPT_NAME': u'', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7.2', 'SESSIONNAME': 'Console', 'SYSTEMDRIVE': 'C:', 'SYSTEMROOT': 'C:\\WINDOWS', 'TEMP': 'D:\\Temp\\Temp', 'TMP': 'D:\\Temp\\Temp', 'USERDOMAIN': '4DD4684509B1479', 'USERNAME': 'Administrator', 'USERPROFILE': 'C:\\Documents and Settings\\Administrator', 'WINDIR': 'C:\\WINDOWS', 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x00AB50D0>, 'wsgi.file_wrapper': <class 'django.core.servers.basehttp.FileWrapper'>, 'wsgi.input': <socket._fileobject object at 0x02035D70>, 'wsgi.multiprocess': False, 'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> callback <function index at 0x02035970> resolver <RegexURLResolver Django_Pro.urls (None:None) ^/> urlresolvers <module 'django.core.urlresolvers' from 'F:\Python27\lib\site-packages\django\core\urlresolvers.pyc'> callback_kwargs {} response None urlconf 'Django_Pro.urls' F:\Python27\Django-1.3.1\Django-1.3.1dasf\django\bin\Django_Pro\..\Django_Pro\Users\views.py in index #-*- coding:utf-8 -*-from django.shortcuts import render_to_responsefrom Django_Pro.Users.models import Usersdef index(rq):    #获取Users数据模型对应表中的数据    latest_users_list = Users.objects.all().order_by('-username')[:5]    return render_to_response('users/index.html',{'latest_users_list':latest_users_list}) ...? Local vars Variable Value rq <WSGIRequestGET:<QueryDict: {}>,POST:<QueryDict: {}>,COOKIES:{'Hm_lvt_786fd821ce6c6cdef15bef8fc15750f0': '1323184293406', 'S9Tc_2132_smile': '1D1', 'S9Tc_2132_ulastactivity': '3e951b5b3OaVmYG8dGhSZxw%2FlY5XnFb3%2Fqx3%2F3N68HAgHarDM0pR', 'cnzz_eid': '704592-1318220328-http%3A//127.0.0.1/dede/makehtml_homepage.php', 'kGT7_2132_home_readfeed': '1319125288', 'kGT7_2132_smile': '1D1', 'kGT7_2132_ulastactivity': '8298veTBwBiSKpPx9nzZujByZDF0udOK8eaiAxvdewUn2C1JLllD', 'ltime': '1319780151125', 'rtime': '5'},META:{'1830B7BD-F7A3-4C4D-989B-C004DE465EDE': '1018:163778', 'ALLUSERSPROFILE': 'C:\\Documents and Settings\\All Users', 'APPDATA': 'C:\\Documents and Settings\\Administrator\\Application Data', 'CLIENTNAME': 'Console', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'COMPUTERNAME': '4DD4684509B1479', 'COMSPEC': 'C:\\WINDOWS\\system32\\cmd.exe', 'CONTENT_LENGTH': '', 'CONTENT_TYPE': 'text/plain', 'CSRF_COOKIE': 'f6446ce17f9086d23571cf7d2ae7db96', 'DJANGO_SETTINGS_MODULE': 'Django_Pro.settings', 'FP_NO_HOST_CHECK': 'NO', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HOMEDRIVE': 'C:', 'HOMEPATH': '\\Documents and Settings\\Administrator', 'HTTP_ACCEPT': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'zh-cn', 



这是没有数据的原因还是us规则没设置好呢?



[解决办法]
TemplateDoesNotExist('users/index.html',) 模板不存在。。检查下路径映射对不
[解决办法]
INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)
如果不用VALUES,table_name和()之间是不是需要空格?
[解决办法]
各语句之间要分号隔开
[解决办法]
探讨
INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)
如果不用VALUES,table_name和()之间是不是需要空格?

热点排行