A Cookiecutter Template for Morepath
This template either generates a RESTful application or a tradiational web application (HTML). The wizard will ask you to choose between those two options.
If you go with the traditional route, the Chameleon templating language will be used. Feel free to switch to another templating language. We've chosen one for you because adding support for multiple templating languages would make this cookiecutter template quite messy.
To use this template, install the latest version of cookiecutter:
pip install --upgrade cookiecutter
You will also need Python 2.7 or 3.3+ and virtualenv.
Create a new package with the wizard:
(The result will be stored in a new directory named after the package)
Inside the so created package create a virtualenv:
cd mypackage virtualenv env source env/bin/activate
And install the package (including tests):
env/bin/pip install -e '.[test]'
You can now run your application using either of the following commands:
env/bin/run-app env/bin/python -m mypackage
Once the application is running you can open it in your browser under http://localhost:5000.
There is also one example test included which you can run using:
This template is pretty bare-bones. We do not offer support for various integrations like travis-ci or tox, because we mean to help out beginners with Morepath.
If you require more advanced features, feel free to fork!
In the resulting directory you find the following files:
./app.py: Contains the Morepath application.
./model.py: Contains the models you are working with.
./path.py: Contains the paths pointing to the models.
./view.py: Contains the views associated with the models.
./__main__.py: Contains the run script for the test server.
./tests/test_app.py: Contains an example test.
The Cookiecutter Template for Morepath is released into the public domain.