# coding: utf-8
import sys
import os
import sqlite3
g_basePath = os.path.dirname(__file__)
sys.path.append(g_basePath)
os.chdir(g_basePath)
def application(environ, start_response):
status = '200 OK'
con = sqlite3.connect('webb.db')
c = con.cursor()
c.execute('select * from users')
output = str( c.fetchall() )
c.execute('update users set auto=0')
con.commit()
response_headers = [('Content-type', 'text/html; charset=utf-8'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
user@user-desktop:/var/www/main$ ls -l webb.db
-rwxrwxrwx 1 user user 9216 2010-01-27 22:52 webb.db
[Thu Jan 28 00:21:02 2010] [error] [client 92.255.165.89] Traceback (most recent call last):
[Thu Jan 28 00:21:02 2010] [error] [client 92.255.165.89] File "/var/www/main/main.wsgi", line 19, in application
[Thu Jan 28 00:21:02 2010] [error] [client 92.255.165.89] c.execute('update users set auto=0')
[Thu Jan 28 00:21:02 2010] [error] [client 92.255.165.89] OperationalError: unable to open database file
в чем проблемма? написал сайт, начал выкладывать, а тут на те… :(