mardi 7 avril 2015

Internal Server error: using python script with sqlite using module mod_wsgi in apache

This is my code example.



import sqlite3

def application(environ, start_response):

output = "<center><p> LOG</p>"

db = sqlite3.connect('/root/example.db')
db.row_factory = sqlite3.Row
cursor = db.cursor()
cursor.execute('''SELECT id, message,date FROM table''')
for row in cursor:
print('{0} : {1}, {2}'.format(row['id'], row['message'], row['date']))
db.close()

start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')])
return output


I get Internal Server Error.


How would solve the problem?


Aucun commentaire:

Enregistrer un commentaire