Python and web technologies


Python and web technologies

Python as a general purpose language

  • OOP and functional
  • Scripting
  • Security
  • Scientific Python
  • Big data
  • Teaching tool
  • "Glue" for several pieces
  • Web

Python and web

Web = Backend and Frontend

  • Frontend - Javascript undisputed leader
  • Frontend - fullstack languages (Clojure*, NodeJS)
  • Frontend - Python? (

Python and web so far means only backend. Python needs more technologies in the front side to build webs: Javascript, Backbone, AngularJS, React...

Python and web

Python and backend

  • Libraries and utilities
  • Frameworks
  • Platforms

Libraries and utilities

  • Requests: HTTP library "for human beings" (
  • Gunicorn: Python app server (
  • Werkzeug: WSGI utility library (
  • Twisted: library to build asynchronous web applications (


On top of libraries and utilities

A Web framework is a set of utilities with inner consistency which provide a simple way to solve common issues in web development: authentication, ddbb access, template rendering, request and response management, sessions...

A web framework is the tool and the opinion and good practices around


Business on top of a framework

  • Nikola (
  • Pelican (
  • PuPut (
  • Django-CMS (
  • Symposion (

Frameworks - BottlePy

Is: a microframework whose potential resides in fast prototyping and small websites

Is not: the tool for big applications

Has: Routing, Templates, Utilities (forms, file uploads, cookies, headers...), Server (wsgi)

Who: me!

Frameworks - BottlePy

Hello world

from bottle import route, run, template

def index(name):
    return template("Hello {{name}}!", name=name)

run(host="localhost", port=8080)

Frameworks - Flask

Is: a microframework running over Werkzeug, with Jinja templates "and good intentions".

Is not: full of features out of the box

Has: built in development server and debugger, unit testing support, RESTful, Jinja2 templating, support for secure cookies, 100% WSGI 1.0 compliant, extensively documented

Who: (Dominion clone!!)

Frameworks - Flask

Hello world

from flask import Flask
app = Flask(__name__)

def hello():
    return "Hello World!"

if __name__ == "__main__":

Frameworks - Pyramid

Is: component ecosystem, with Pyramid as web framework. Small core unopinionated.

Is not: as mature as Django although it competes with Django

Has: fast prototyping, decorators based configuration, routing, debugger, add-ons...

Who: HOT-OSM, Reddit, Mozilla

Frameworks - Pyramid

Hello world

from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response

def hello_world(request):
    return Response('Hello %(name)s!' % request.matchdict)

if __name__ == '__main__':
    config = Configurator()
    config.add_route('hello', '/hello/{name}')
    config.add_view(hello_world, route_name='hello')
    app = config.make_wsgi_app()
    server = make_server('', 8080, app)

Frameworks - Django

Is: the reference tool for web development with Python

Is not: free of strong opinion; famous for front integration

Has: everything, built-in or libraries (DRF), community!!

Who: Taiga, Guía Repsol, Disqus, Pinterest... (

Extra Bonus - Beyond the framework

Anillo (

Which framework should I choose?