Bottle is a single file web microframework.

> Example: "Hello World" in a bottle

from bottle import route, run, template 

def index(name):
    return template('<b>Hello {{name}}</b>!',

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

There are docs and every function is Ctrl-F'able within

On Friday, March 30, 2018, kirby urner <> wrote:

Very interesting.  I note that free users are relegated to Python 2.7

Server modules can be Python 3.6 (outside the free version)

Client stuff compiles to JavaScript and is approximately 2.7

That's a bit confusing maybe.  I try to avoid 2.7 but that's not easy.

In my Coding with Kids work, we use to teach Python, which depends on Skulpt.  Also 2.x ish.


On Fri, Mar 30, 2018 at 11:49 AM, Jason Blum <> wrote: is a pretty interesting approach to Python web applications.

On Fri, Mar 30, 2018 at 2:05 PM, kirby urner <> wrote:

Hi Aivar --

I think it's a fine idea to write simple Python scripts that write HTML files, which you may then pull up in the browser.

There's no need to put a server behind static web pages.  So, for example, I'll have my students write a page of bookmarks:

# -*- coding: utf-8 -*-
Created on Wed Nov  4 18:02:30 2015

@author: Kirby Urner

# tuple of tuples
bookmarks = (
    ("", ""),
    ("", ""),
    ("Python Docs", ""),
    ("Spaghetti Code", ""),
    ("Structured Programming", ""),
    ("Map of Languages", ""),
    ("XKCD", ""),

page = '''\

html = """\
<TITLE>Bookmarks for Python</TITLE>
<BR />

the_body = ""
for place, url in bookmarks:
    the_body += "<li><a href='{}'>{}</a></li>\n".format(url, place)

webpage = open("links.html", "w")
print(page.format(html.format(the_body)), file=webpage)

All you need add to your example is using print() to save to a file, so the browser has something to open.

I would not call this a "web app" yet it's instructive in showing how Python can write HTML files.


On Wed, Mar 28, 2018 at 12:18 AM, Aivar Annamaa <> wrote:


Let's say my students are able to write programs like this:
name = input("name")

if name == "Pete":
    greeting = "Hi"
    greeting = "Hello!"

{greeting} {name}!

I'd like to allow them start writing web-apps without introducing functions first (most web-frameworks require functions).

It occurred to me that it's not hard to create a wrapper, which presents this code as a web-app (input would be patched to look up GET or POST parameters with given name).

This approach would allow simple debugging of the code on local machine and no extra libraries are required in this phase.

Any opinions on this? Has this been tried before?

best regards,

Edu-sig mailing list

Edu-sig mailing list