A Cookiecutter (project template) for creating a Pyramid starter project using URL dispatch. Customizable options upon install are Jinja2, Chameleon, or Mako for templating and memory, SQLAlchemy, or ZODB for a persistent backend.
- Python 2.7 or 3.4+
- cookiecutter
This cookiecutter has several branches to support new features in Pyramid or avoid incompatibilities.
latest
aligns with the latest stable release of Pyramid, and is the default branch on GitHub.master
aligns with themaster
branch of Pyramid, and is where development takes place.x.y-branch
aligns with thex.y-branch
branch of Pyramid.
Generate a Pyramid project, following the prompts from the command.
$ cookiecutter gh:Pylons/pyramid-cookiecutter-starter
Optionally append a specific branch checkout to the command:
$ cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout master
Finish configuring the project by creating a virtual environment and installing your new project. These steps are output as part of the cookiecutter command above and are slightly different for Windows.
# Change directory into your newly created project. $ cd myproj # Create a virtual environment... $ python3 -m venv env # ...where we upgrade packaging tools... $ env/bin/pip install --upgrade pip setuptools # ...and into which we install our project and its testing requirements. $ env/bin/pip install -e ".[testing]"
Note: If you are not running the SQLAlchemy backend, please skip to step 5
Initialize and upgrade the database using Alembic.
# Generate your first revision. $ env/bin/alembic -c development.ini revision --autogenerate -m "init" # Upgrade to that revision. $ env/bin/alembic -c development.ini upgrade head
Load default data into the database using a script.
$ env/bin/initialize_tutorial_db development.ini
Run your project's tests.
$ env/bin/pytest
Run your project.
$ env/bin/pserve development.ini