
November 23rd, 2003, 12:26 AM
|
|
I hate nerds
|
|
Join Date: Jul 2003
Posts: 533
Time spent in forums: 20 h 48 m 41 sec
Reputation Power: 0
|
|
|
twisted webserver
http://www.twistedmatrix.com/docume...istedweb#auto17
im looking at the example in hte above link. im really new to python and UNIX for that matter so bare with me. to summarize...
i have a file called test.rpy with this code
Code:
from twisted.web import resource
from SillyWeb import Counter
counter = registry.getComponent(Counter)
if not counter:
registry.setComponent(Counter, Counter())
counter = registry.getComponent(Counter)
class MyResource(resource.Resource):
def render(self, request):
counter.increment()
return "you are visitor %d" % counter.getValue()
resource = MyResource()
and a SillyWeb.py file with this
Code:
class Counter:
def __init__(self):
self.value = 0
def increment(self):
self.value += 1
def getValue(self):
return self.value
i put SillyWeb.py in the same folder as test.rpy. When accessing the server i get this error
web.Server Traceback (most recent call last):
exceptions.ImportError: No module named SillyWeb
i dont know what to do.
|