使用python和python cgi插入sqlite3 [英] sqlite3 insert using python and python cgi

查看:114
本文介绍了使用python和python cgi插入sqlite3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. db.py 中,我可以使用函数( func insert )将数据正确插入sqlite.
  2. 现在我想通过python-fastcgi将数据插入sqlite,在 fastcgi(仅命名为 post.py ),我可以正确获取请求数据,但是 当我调用 db.insert 时,它给了我内部服务器错误.
  1. In db.py,I can use a function(func insert) insert data into sqlite correctly.
  2. Now I want to insert data into sqlite through python-fastcgi, in fastcgi (just named post.py ) I can get the request data correctly,but when I call db.insert,it gives me internal server error.

我已经做过chmod 777 slqite.db.有人知道出什么问题吗?

I already did chmod 777 slqite.db. Anyone know whats problem?

推荐答案

最后我找到了答案:

sqlite3库还需要在包含该库的目录上具有写权限,这可能是因为它需要创建一个锁定文件.

the sqlite3 library needs write permissions also on the directory that contains it, probably because it needs to create a lockfile.

因此,当我使用sql插入数据时没有问题,但是当我通过web cgi,fastcgi等进行插入数据时会出现错误.

Therefor when I use sql to insert data there is no problem, but when I do it through web cgi,fastcgi etc)to insert data there would be an error.

只需向目录添加写权限即可.

Just add write permission to the directory.

这篇关于使用python和python cgi插入sqlite3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆