locked SQLite database errors with WSGI python app -
i'm having issues making multiple ajax post calls functions access database in web app using sqlite , mod-wsgi. have no issues making requests 1 function, call different function, started getting "database locked" errors. i've tried setting variables global , accessing them in 2 functions, opening , closing database in each function, no avail.
what's proper way interface database if have 1 application function in code? threads? persistent connections?
i've used django before, wanted bare-bone simple app running on local machine.
the relevant section of code is:
con = sqlite3.connect("/var/www/knowledge/eurisko.sqlite") con.row_factory = sqlite3.row cursor = con.cursor() cursor.execute("update notes_content set c1content=?, c2timestamp=? c0title=?", [content, timestamp, title]) con.commit() cursor.close() con.close() the full file here: http://pastebin.com/7yuizfi2
i'm running apache 2.2 on ubuntu 10 libapache2-modwsgi , python 2.7.
see warnings concurrent access multiple processes in sqlite documentation.
http://www.sqlite.org/faq.html#q5
this information provided on mod_wsgi list question asked, following here.
this can issue because apache/mod_wsgi supports both single , multi process configurations. op using multi process configuration. see:
http://code.google.com/p/modwsgi/wiki/processesandthreading
for description of apache/mod_wsgi process/threading model.
Comments
Post a Comment