https://github.com/hkage/cookiecutter-tornado
Cookiecutter template for Tornado based projects
https://github.com/hkage/cookiecutter-tornado
cookiecutter cookiecutter-template cookiecutter-tornado python tornado tornado-template
Last synced: 3 months ago
JSON representation
Cookiecutter template for Tornado based projects
- Host: GitHub
- URL: https://github.com/hkage/cookiecutter-tornado
- Owner: hkage
- License: mit
- Created: 2012-12-20T10:17:57.000Z (over 13 years ago)
- Default Branch: development
- Last Pushed: 2022-12-09T06:41:33.000Z (over 3 years ago)
- Last Synced: 2024-04-17T06:02:39.140Z (almost 2 years ago)
- Topics: cookiecutter, cookiecutter-template, cookiecutter-tornado, python, tornado, tornado-template
- Language: Python
- Homepage:
- Size: 179 KB
- Stars: 56
- Watchers: 3
- Forks: 17
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.md
- License: LICENSE.rst
Awesome Lists containing this project
- awesome - hkage/cookiecutter-tornado - Cookiecutter template for Tornado based projects (<a name="Python"></a>Python)
README
Tornado Cookiecutter template
=============================
.. class:: no-web no-pdf
|license| |build|
.. contents::
.. section-numbering::
This is my cookiecutter template to build a simple, fast and rock solid website based upon
the Tornado_ framework. There are quite many Tornado templates out there,
but I wanted to start something from scratch, that fits my needs and evolves out
of years of experiences (positive and negative alike) with other Python based webframeworks
like Turbogears and Django.
Of course this template is not designed for larger data structures. The main
focus is on scalability, fast data access and small library dependencies.
Features
--------
* Configurable as a Cookiecutter_ template
* Basic HTML5 Boilerplate_
* (Optional) pytest
* (Optional) tox
* (Optional) Docker support
* (Optional) Vagrant support
* (Optional) Internationalization (i18n) support
Usage
-----
Install Cookiecutter_ ::
$ pip install cookiecutter
Initialize the project with cookiecutter and answer some questions for the newly started project::
$ cookiecutter https://github.com/hkage/cookiecutter-tornado
Template development
-----------------------
If you decide to contribute to this cookiecutter template, feel free to fork it and make a pull request. To start with
the development of this template, you need to install some Python requirements::
[sudo] pip install poetry
After that simply let pipenv install all requirements::
$ poetry install
To activate the virtual environment, simply call::
$ poetry shell
Now you are able to run the tests for this template::
$ py.test
In addition to that you can install tox to test the template against different Python versions::
$ [sudo] pip install tox
And then run the tests with::
$ tox
Tornado project development
---------------------------
Testing
~~~~~~~
All tests will be added to the `tests` directory, whether you are using pytest for testing or other tools like nose- or unittests.
pytest
******
With pytest you will be able to run the tests with::
$ py.test
Running the application
~~~~~~~~~~~~~~~~~~~~~~~
To start the final application, just run the following fabric command::
$ fab devserver
This will tell Tornado to start the application with the default port 8888. If
you want to use another port, just type::
$ fab devserver:port=8000
In addition to that, see the fabfile.py Script for other parameters and
commands.
Vagrant
*******
To run the server within a Vagrant VM, you need to install Vagrant 1.7.x and the
Vagrant Alpine plugin::
$ vagrant plugin install vagrant-alpine
After that you can start the development server with the following command::
$ vagrant up
$ fab vagrant devserver
You can now access your application via `http://localhost:8000`
Docker
******
Install docker and docker compose in the latest version. Then start the tornado
project with docker-compose::
$ docker-compose up
You can now access your application via `http://localhost:8000`
.. _Tornado: http://www.tornadoweb.org/
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _Boilerplate: https://html5boilerplate.com/
.. |license| image:: https://img.shields.io/badge/license-MIT-green.svg
:target: https://github.com/hkage/cookiecutter-tornado/blob/development/LICENSE.rst
.. |build| image:: https://github.com/hkage/cookiecutter-tornado//workflows/Test/badge.svg
:target: https://github.com/hkage/cookiecutter-tornado//actions