Re: Development version and Twisted

Paul Moore <[email protected]>
Newsgroups gmane.comp.web.wiki.moin.devel
Message-ID <[email protected]>
Florian Festi <[email protected]> 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)



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.