durusmail: quixote-users: scgi and Quixote 2.6
scgi and Quixote 2.6
2009-05-06
2009-05-06
2009-05-07
2009-05-07
scgi and Quixote 2.6
dream fish
2009-05-06
i'm new to python and quixote. i've installed
apache2.2.11+python2.5.2+quixote2.6+scgi1.13 on my computer(i use fedora10),
but i've met a problem:
i read the article "A Quixote Application:Getting
Started",
and put the simpliest example code on my computer, the code files are:
myapp/scgi-server.py
myapp/ui/__init__.py
myapp/ui/servicesui.py
but i couldn't run it successfully.

i run ./scgi-server.py -p 3000 -l logfile.log

then, in the logfile i found "AttributeError: 'str' object has no attribute
'_q_traverse'", and i searched it, there's an answer(
http://mail.mems-exchange.org/durusmail/quixote-users/4570/), but it's not i
want, i only want to use the publish.py on my computer, don't want to go
back to publish1, i'd rather change the code. so, how should i write the
scgi-server.py file?

here is my current scgi-server.py:

#!/usr/bin/python
from scgi.quixote_handler import QuixoteHandler, main
from quixote.publish import Publisher

from quixote import enable_ptl
enable_ptl()

class MyAppHandler(QuixoteHandler):
    publisher_class = MyPublisher
    root_namespace = "myapp.ui"
    prefix = ""

if __name__ == '__main__':
    main(MyAppHandler)

i also test a script which was running successfully. but i wonder, is that
too simply, what if i want to write my own Publisher.
the script is as follows(tand he whole only two files: testtest.ptl, the
script below):

#!/usr/bin/python
from scgi.quixote_handler import QuixoteHandler, main
from quixote import enable_ptl
from quixote.publish import Publisher
enable_ptl()

def create_publisher():
    from testtest import RootDirectory
    return Publisher(RootDirectory(), display_exceptions="plain")

if __name__ == "__main__":
    from quixote.server import scgi_server
    scgi_server.run(create_publisher, port=3000, script_name="")

please give me some advice. waiting for help, thank you.
reply