Search code examples
pythonsqlitefastcgi

sqlite3 insert using python and python cgi


  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.

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


Solution

  • Ffinally I found the answer:

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

    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.