Skip to content

yumedzi/shot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shot

shot is Python super micro web framework. It is designed to be super fast and super easy to use for writing simple tasks.

Features:

  • parametrized routing
  • builtin Jinja-like template engine
  • dev web server
  • batteries for creating simple REST API.
  • it can be used with SQLAlchemy as ORM.

Current status

  • routing - YES
  • wrapping REQUEST (GET/POST, form multipart data) - YES
  • template engine - YES
  • dev server - YES
  • parametrized routing - YES
  • reloading dev server in DEBUG - NO
  • Docs - NO
  • REST API batteries - NO
  • ORM integration batteries - NO

Example

pip install shot, gunicorn
  • Example "prog.py":
from shot import application, route, render, run

@route('/')
def main(request):
    return "Hello World"

@route('/name')
def example(request):
    context = dict(
        name = 'John Stark',
        brothers = ['Rickon', 'Bran', 'Robb']
    )
    return render('example.html', context)

if __name__ == '__main__':
    run()
  • Template 'templates/example.html':
{% extends 'main.html' %}

{% block contents %}
<p>Hello, {{ name|capitalize }}

Your brothers:
<ul>
{% for brother in brothers %}
<li>Brother number {{ loopcounter }}: {{ brother }} </li>
{% empty %}
... sorry, you don't have any left.
{% endfor %}
</ul>
{% endblock %}
  • Running:
python prog.py

or

gunicorn prog
  • The web app will be hosted at http://127.0.0.1:8000/

Dev plan

  1. Dev server ---> 0.5
  2. Extended routing rules ---> 0.6
  3. ORM ---> 0.7
  4. REST --- 0.8

Documentation

... Will be here soon ...

Contacts

About

super micro web framework for Python

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors