diff --git a/shop.tac b/shop.tac new file mode 100644 index 0000000..9ccc1da --- /dev/null +++ b/shop.tac @@ -0,0 +1,35 @@ +############################################################################## +# Start zope with twisted WSGI server +# +# Install required python packages with pip: +# +# ./venv/bin/pip install twisted plaster plaster_pastedeploy +# +# Start zope: +# +# ./venv/bin/twistd -ny shop.tac +############################################################################## + +from twisted.application import internet +from twisted.application import service +from twisted.internet import reactor +from twisted.web.server import Site +from twisted.web.wsgi import WSGIResource +import os +import plaster + +config='./instance/etc/zope.ini' +config = os.path.abspath(config) +port = 8081 + +# Get the WSGI application +loader = plaster.get_loader(config, protocols=['wsgi']) +app = loader.get_wsgi_app('main') + +# Twisted WSGI server setup +resource = WSGIResource(reactor, reactor.getThreadPool(), app) +factory = Site(resource) + +# Twisted Application setup +application = service.Application('zope') +internet.TCPServer(port, factory).setServiceParent(application)