ich versuch mich etwas mit mod_python und psp.
Klappt auch soweit alles ganz gut nur mysql will nicht
folgendes Beispiel
Code: Alles auswählen
from mod_python import psp
import MySQLdb
def _navi(level):
#Verbindung zur Datenbank:
connection = MySQLdb.connect(
host="localhost",
db="createlog",
user="----------",
passwd="-----------")
#Erstelle Dict Cursor
curser = connection.cursor()
query = """SELECT * from page"""
curser.execute(query)
result = curser.fetchall()
connection.commit()
navi = result
return navi
def index(req, sitename=''):
name = "home"
if sitename:
name = sitename
req.content_type = 'text/html'
main_tmpl = psp.PSP(req, filename='templ/main.tmpl')
title = "test text hallo"
main = "test content main"
navi_tmpl = _navi(2)
hello_tmpl.run(vars = { 'cont_title': title, 'cont_main': main, 'cont_navi': navi_tmpl })
return
Code: Alles auswählen
[Tue Nov 29 12:49:46 2005] [notice] mod_python: (Re)importing module 'mod_python.publisher'
[Tue Nov 29 12:49:46 2005] [notice] mod_python: (Re)importing module 'index' with path set to '['/home/www/default/htdocs']'
[Tue Nov 29 12:49:47 2005] [notice] child pid 7797 exit signal Segmentation fault (11)
Der mysql Code auf der Konsole funktioniert aber. Muss man da noch was beachten oder geht das mit mod_python komplett anders?
Danke schon mal