From 2a68eca20c2fc4184ffb14e0e8d95caf8c9072e6 Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Sat, 2 Aug 2014 14:49:27 +0200 Subject: [PATCH] Add example ``twisted.cfg`` buildout configuration and ``cone.tac`` twisted configuration file for running cone with twisted WSGI. --- .gitignore | 1 + README.rst | 4 ++++ buildout.cfg => base.cfg | 9 +-------- cone.tac | 26 ++++++++++++++++++++++++++ paster.cfg | 10 ++++++++++ twisted.cfg | 25 +++++++++++++++++++++++++ 6 files changed, 67 insertions(+), 8 deletions(-) rename buildout.cfg => base.cfg (93%) create mode 100644 cone.tac create mode 100644 paster.cfg create mode 100644 twisted.cfg diff --git a/.gitignore b/.gitignore index 44001f8b..314b3a4d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /.pydevproject /.pydevproject.bak /.settings/ +/twistd.pid /src/cone.app.egg-info/ /bin/ /env/ diff --git a/README.rst b/README.rst index 5f2ec147..a64a516e 100644 --- a/README.rst +++ b/README.rst @@ -73,6 +73,10 @@ Changes 1.0.dev0 (unreleased) --------------------- +- Add example ``twisted.cfg`` buildout configuration and ``cone.tac`` twisted + configuration file for running cone with twisted WSGI. + [rnix, 2014-08-02] + - Adopt ``IWorkflowState`` interface. Workflow name is now set directly on node. Optional a trnaslation string factory can be set for workflow state and transision translations. diff --git a/buildout.cfg b/base.cfg similarity index 93% rename from buildout.cfg rename to base.cfg index 540756cc..28449054 100644 --- a/buildout.cfg +++ b/base.cfg @@ -1,6 +1,5 @@ [buildout] parts = - instance test coverage pydev @@ -34,12 +33,6 @@ yafowil.bootstrap = git git@github.com:bluedynamics/yafowil.bootstrap.git cone.tile = git git@github.com:bluedynamics/cone.tile.git bdajax = git git@github.com:bluedynamics/bdajax.git -[instance] -recipe = zc.recipe.egg:scripts -dependent-scripts = true -eggs = - cone.app - [testenv] TESTRUN_MARKER = True @@ -68,7 +61,7 @@ mode = 755 [pydev] recipe = pb.recipes.pydev -eggs = ${instance:eggs} +eggs = ${test:eggs} [sphinx] recipe = collective.recipe.sphinxbuilder diff --git a/cone.tac b/cone.tac new file mode 100644 index 00000000..9f66a993 --- /dev/null +++ b/cone.tac @@ -0,0 +1,26 @@ +import os +from twisted.web.server import Site +from twisted.web.wsgi import WSGIResource +from twisted.internet import reactor +from twisted.application import ( + internet, + service, +) +from pyramid.paster import get_app + + +config='./cone.ini' +config = os.path.abspath(config) +port = 8081 + + +# Get the WSGI application +myApp = get_app(config, 'main') + +# Twisted WSGI server setup +resource = WSGIResource(reactor, reactor.getThreadPool(), myApp) +factory = Site(resource) + +# Twisted Application setup +application = service.Application('cone') +internet.TCPServer(port, factory).setServiceParent(application) \ No newline at end of file diff --git a/paster.cfg b/paster.cfg new file mode 100644 index 00000000..26ef89dd --- /dev/null +++ b/paster.cfg @@ -0,0 +1,10 @@ +[buildout] +extends = base.cfg + +parts += instance + +[instance] +recipe = zc.recipe.egg:scripts +dependent-scripts = true +eggs = + cone.app \ No newline at end of file diff --git a/twisted.cfg b/twisted.cfg new file mode 100644 index 00000000..2bb32cbd --- /dev/null +++ b/twisted.cfg @@ -0,0 +1,25 @@ +[buildout] +extends = base.cfg + +parts += scripts + +[twisted] +recipe = zc.recipe.egg +eggs = + Twisted + +[config] +app = cone.app +eggs = cone.app + +[scripts] +recipe = minitage.recipe.scripts +interpreter = python + +# Add our package source to the python path to allow twisted TAPs to be +# accessible at runtime. +extra-paths = ${buildout:directory}/${config:app} + +eggs = + ${config:eggs} + ${twisted:eggs}