Giter Club home page Giter Club logo

tornado-cookiecutter's Introduction

Tornado Cookiecutter

This is a quick cookiecutter to start building apps with Tornado.

Features

  • Tornado 4
  • RESTful handler with Restless
  • SQLAlchemy ORM pre-configured
  • Run tests with pytest
  • API documentation with Swagger
  • 12factor based settings via python-dotenv
  • Project README template
  • Test-data generator with mixer
  • Resource provioning with a ansible
  • Docker support using docker-compose for development and production
  • Procfile and tsuru.yaml dor deploy at Tsuru (Heroku compatible)
  • Work with python 3.4.1+
  • Apps based at Django apps

Optional Integrations

  • Integration with Sentry for error logging

Create project

Let's pretend you want to create a Tornado Project called "maguire". First, get Cookiecutter. It's aewsome.

pip install cookiecutter

Now run it against this repo:

Warning: project_slug, path_name must be a valid names of our pattern.

Answer the prompts with yout own desired options. For example:

$ cookiecutter https://github.com/luizalabs/tornado-cookiecutter.git
Cloning into 'tornado-cookiecutter'...
remote: Counting objects: 467, done.
remote: Compressing objects: 100% (214/214), done.
remote: Total 467 (delta 192), reused 467 (delta 192), pack-reused 0
Receiving objects: 100% (467/467), 53.39 KiB | 0 bytes/s, done.
Resolving deltas: 100% (192/192), done.
Checking connectivity... done.
project_name []: maguire
project_slug []: maguire# this field is not required, because it is generate based at a project_name
short_description []: A host description of project README
description []: Description of project. Use at project README
version [0.1.0]:
author []: Matheus Oliveira
repo []:
travis_url [luizalabs/maguire]:

Enter the project and take a look around:

cd maguire
ls

Create a git repo and push ir here:

git init
git add .
git commit -m "first commit"
git remote add origin [email protected]:luizalabs/cookiecutter.git 
git push -u origin master

Settings

Settings as a dictionary, with full reference

settings = {
    # debug: If True the application runs in debug mode
    'debug': True,

    ...
}

Shell

Added shell to play with the system

(venv) ~/Works/tornado-cookiecutter$ make shell
>>> import tornado.web
>>>

Apps

Added apps folder to separate logic in modules


Importing urls

Enabled importing/including urls from different apps, coretaing pattern

from tornado.web import URLSpec as url

urls = [
    url(r"/", HomeHandler),
    url(r"/static/(.*)", web.StaticFileHandler, {"path": settings.get('static_path')}),
]
# this will include patterns from urls.py inside `core` app.
urls += include(r"/core/", "{{project_name}}.core.urls")

/{{project_name}}/core/urls.py

from tornado.web import URLSpec as url

urls = [
    url(r"test/", TestHandler),  # This is `/core/test/`
]

Server start/stop message

Showing message when starting and stoping the server

(venv) ~/Works/tornado-cookiecutter$ make runserver
Listening server at http://127.0.0.1:8888
^C
Stopping server.

=======

TODO

  • logging
  • ansible
  • docker

tornado-cookiecutter's People

Contributors

matheusho avatar matheusoliveira-luizalabs avatar rodrigosavian-luizalabs avatar benzid-wael avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.