[Moin-devel] Re: Development version and Twisted
Paul Moore
pf_moore at yahoo.co.uk
Sun Dec 21 15:31:03 EST 2003
Florian Festi <festifn at rupert.informatik.uni-stuttgart.de> writes:
> The 1.2 branch is under heavy development and the nightly builds are much
> less stable than they used to be in the 1.1 line. They definetly should
> not be used in productive environments. AFAIK even the UI is broken
> because of the upcomming skinning support.
>
> Nevertheless are testers welcome.
It wasn't hard to get something basic running. I needed to edit
twisted-moin quite heavily (I'll post it here, even though it could
use some tidying up). Once I'd done this, I created an instance
directory as follows:
...\MoinInstance
twisted-moin.py
moin_config.py
data -- copy of the "data" directory installed with MoinMoin
Then starting MoinMoin was simply a case of
C:\Apps\Python\Scripts\twistd.py --python=startmoin.py -n
The only problem I see so far is that the icon for Wiki: and MoinMoin:
links is not found. The URL for the image shows as
http://localhost:8888/classic/img/moin-inter.png (note the lack of a
/wiki/ path element before /classic/). I can't see an obvious place
I've failed to configure, but I'll keep looking - it seems to work
right on the MoinMoin website.
Paul.
---- twisted-moin.py ----
from twisted.web import script, static, server, vhost, resource, util
from twisted.internet import app, threads, reactor
import random
import sys, os
# Add the directory of this file to sys.path
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from MoinMoin.request import RequestTwisted
RESOURCES = os.path.join(sys.prefix, "share", "moin", "htdocs")
PORT = 8888
# User/group to run under
# Usually, it runs under the www-data user and group.
UID = 'www-data'
GID = 'www-data'
from twisted.python import threadable
threadable.init(1)
class WikiResource(resource.Resource):
isLeaf = 1
def render(self, request):
return server.NOT_DONE_YET
class WikiRoot(resource.Resource):
def getChild(self, name, request):
if request.prepath == [] and name == 'wiki':
return resource.Resource.getChild(self, name, request)
else:
req = RequestTwisted(request, name, reactor)
threads.deferToThread(req.run)
return WikiResource()
# The root of the HTTP hierarchy
default = WikiRoot()
# here is where img and css come from
default.putChild('wiki', static.File(RESOURCES))
# set logfile name.
# This is the *Apache compatible* log file, not the twisted-style logfile.
# Leaving this as None will have no Apache compatible log file. Apache
# compatible logfiles are useful because there are quite a few programs
# which analyse them and display statistics.
logPath = None
# Allow the requestor to tell us which host we are
# default.putChild('vhost', vhost.VHostMonsterResource())
# Make sure it is easy to add new virtual hosts:
root = vhost.NameVirtualHost()
root.default = default
# To add virtual hosts
# exampleRoot = static.File('/var/vhosts/example')
# root.addHost('localhost', default)
# Generate the Site factory. You will not normally
# want to modify this line.
site = server.Site(root, logPath=logPath)
# Set user/group to run under
# Usually, it runs under the www-data user and group.
uid = None
gid = None
try:
import pwd, grp
uid = pwd.getpwnam(UID)[2]
gid = grp.getgrnam(GID)[2]
except ImportError:
pass
# Generate the Application. You will not normally
# want to modify this line.
application = app.Application("web", uid=uid, gid=gid)
application.listenTCP(PORT, site)
More information about the Moin-devel
mailing list