Quantcast
Channel: Planet Plone - Where Developers And Integrators Write
Viewing all articles
Browse latest Browse all 3535

Tom Gross: Run Plone 5 with WSGI

$
0
0

Now Zope has documented support of WSGI deployment, Plone can have it too. To make it happen we can use a minimal buildout with some minor adjustments:

[buildout]
parts = instance
extends = http://dist.plone.org/release/5-latest/versions.cfg

[instance]
recipe = plone.recipe.zope2instance
http-address =
eggs =
  Plone
  Pillow

[wsgiconf]
recipe = collective.recipe.template
input = zope.wsgi.in
output = zope.wsgi

[app]
recipe = zc.recipe.egg
eggs =
  ${instance:eggs}
  repoze.who
  repoze.tm2
  repoze.retry
  Paste
  PasteScript
  PasteDeploy

Note the empty `http-address` in the instance-recipe. We specify host and port in the WSGI configuration which is generated with the wsgiconf recipe.

This is an example for a simple WSGI deployment. It contains a Paste server listening on port 8080. Content is served from Zope for all URLs except /static, which comes from the directory called static and lives in the var-direcory of the buildout.

With this buildout you need to take care of creating it yourself. But this shouldn't be to hard with the collective.recipe.cmd recipe.

Now here is the WSGI config:

[app:zope-app]
use = egg:Zope2#main
zope_conf = ${instance:location}/etc/zope.conf

[pipeline:zope-pipeline]
pipeline =
   egg:paste#evalerror
   egg:repoze.retry#retry
   egg:repoze.tm2#tm
   zope-app

[app:static]
use = egg:Paste#static
document_root = ${buildout:directory}/var/static

[composite:main]
use = egg:Paste#urlmap
/ = zope-pipeline
/static = static

[server:main]
use = egg:paste#http
host = localhost
port = 8080

The complete configuration files you can find in this gist

After running the buildout we can start the instance with

$ bin/paster serve zope.wsgi

and have fun with a fresh and shiny Plone 5 instance :-)

Plone 5 WSGI Startpage

and we can put static HTML, CSS and JavaScript in the static directory and accessing them directly in our browser.

Plone 5 WSGI Helloworld


Viewing all articles
Browse latest Browse all 3535

Trending Articles