Skip to content

Commit

Permalink
Add shop.tac to be able to start zope with twisted.
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Feb 8, 2023
1 parent ac1c9d0 commit f545f0f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions shop.tac
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit f545f0f

Please sign in to comment.