Wednesday, November 22, 2017

Bottle getting started

Looking for an alternative to Django...


Apparently webpy is basically dead. Bottle seems to be alive, and ported to Python 3

http://bottlepy.org/docs/dev/index.html

sudo pip3.6 install bottle

python

paste this code:

from bottle import route, run, template

@route('/hello/')
def index(name):
    return template('Hello {{name}}!', name=name)

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


Enter in the browser:

http://127.0.0.1:8080/hello/world


It can't be simpler! Compare it to the same code in Java...



No comments: