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

Starzel.de: Four options to try Plone 5.2 on Python 3

$
0
0

Demo page

http://demo-latest-py3.plone.org

http://demo-latest-py2.plone.org

Minimal Buildout

Here is a minimal buildout to run Plone 5.2a2 on Python 3:

[buildout]

parts = instance

extends = https://dist.plone.org/release/5.2a2/versions.cfg



[instance]

recipe = plone.recipe.zope2instance

wsgi = on

eggs =

Plone

Pillow



[instance:python2]

wsgi = off

You set it up like this:

$ python3.7 -m venv .

$ ./bin/pip install -r https://dist.plone.org/release/5.2a2/requirements.txt

$ ./bin/buildout

And start it as usual with ./bin/instance fg

It uses a conditional configuration section to also work in Python 2.7 by switching wsgi off when run with Python 2.

Standalone Development buildout

[buildout]

extends = https://dist.plone.org/release/5.2a2/versions.cfg



parts =

    instance

    zopepy

    packages

    test

    robot



eggs =

    Plone

    Pillow

    collective.easyform



test-eggs =

    collective.easyform [test]



auto-checkout =

    collective.easyform



extensions =

    mr.developer



show-picked-versions = true



[instance]

recipe = plone.recipe.zope2instance

wsgi = on

user = admin:admin

eggs = ${buildout:eggs}

debug-mode = on

verbose-security = on



[instance:python2]

wsgi = off



[zopepy]

recipe = zc.recipe.egg

eggs =

    ${buildout:eggs}

interpreter = zopepy

scripts =

    zopepy

    plone-compile-resources



[packages]

recipe = collective.recipe.omelette

ignore-develop = False

eggs = ${buildout:eggs}

ignores = roman



[test]

recipe = collective.xmltestreport

eggs = ${buildout:test-eggs}

defaults = ['--auto-color', '--auto-progress']



[robot]

recipe = zc.recipe.egg

eggs =

    ${buildout:test-eggs}

    Pillow

    plone.app.robotframework[reload,debug]



[sources]

collective.easyform = git git@github.com:collective/collective.easyform.git branch=python3



[versions]

Starzel buildout

The buildout that we at Starzel.de use supports Plone 5.2a2 with Python 2 and 3.

https://github.com/starzel/buildout

It has some nice features:

  • It extends to config- and version-files on github shared by all projects that use the same version of Plone.
  • It allows to update a project simply by changing the version it extends.
  • It allows to update all projects of one version by changing remote files (very useful for HotFixes).
  • It is minimal work to setup a new project.
  • It has presets for development, testing, staging and production.
  • It has all the nice development-helpers we use.

Quickstart:

$ git clone -b 5.2a2.x https://github.com/starzel/buildout <SOME_PROJECT>

$ cd <MY_PROJECT>

Remove all files that are not needed for a project but are only used for the buildout itself.

$ rm -rf linkto README.rst README.txt .travis.yml secret.cfg_tmpl VERSION.txt local_coredev.cfg CHANGES.rst

If you're not developing the buildout itself you want a create a new git repo.

$ rm -rf .git && git init

Add a file that contains a passwort. Do not use admin as a password in production!

$ echo -e "[buildout]\nlogin = admin\npassword = admin"> secret.cfg

Symlink to the file that best fits you local environment. At first that is usually development. Later you can use production or test. This buildout only uses local.cfg and ignores all local_*.cfg.

$ ln -s local_develop.cfg local.cfg

Create a virtualenv in Python 2.7 or Python 3.7 (Plone 5.2 only).

$ virtualenv .  # for Python 2.7

$ python3.7 -m venv .  # for Python 3 (Plone 5.2 only)

Install and configure Plone

$ ./bin/pip install -r requirements.txt

$ ./bin/buildout

Wrapup

I hope these options help you get started with Python 3. For serious projects you will likely create you own buildout. The main thing to look out for is to set wsgi = on for Python 3 and wsgi = off for Python 2.


Viewing all articles
Browse latest Browse all 3535

Trending Articles