Live data from Hacker News

Ask HN: What Python web programming frameworks and tools are you using?

news.ycombinator.com

11–16 of 16 posts

Re: Ask HN: What Python web programming frameworks and tools are you using?

#14
post #2

Bottle[0], Dataset[1], and pipenv[3]. With those three tools I can create a web app with basic functionality with few lines of code, like a prototype. For example: from datetime import datetime from bottle import get, post, request, run, template, redirect import dataset db = dataset.connect('sqlite:///database.sqlite') entries_table = db['entries'] @get('/') def show_entries(): entries = entries_table.all() entries_…

Where is the code that shows (in the browser) the form for add_entry()? I've used Flask, and for a task like this, you typically have to have either one method which is decorated with a route that takes a list of two method args, "get" and "post" in a list, and then have an if statement to distinguish between code to display the form (get code) and code to process the data on submit (post code), or two separate methods, which could be called get and post or get_entry and post_entry. But your get method does not show a form; it displays all the entries.

Re: Ask HN: What Python web programming frameworks and tools are you using?

#15
post #14
post #2

Bottle[0], Dataset[1], and pipenv[3]. With those three tools I can create a web app with basic functionality with few lines of code, like a prototype. For example: from datetime import datetime from bottle import get, post, request, run, template, redirect import dataset db = dataset.connect('sqlite:///database.sqlite') entries_table = db['entries'] @get('/') def show_entries(): entries = entries_table.all() entries_…

Where is the code that shows (in the browser) the form for add_entry()? I've used Flask, and for a task like this, you typically have to have either one method which is decorated with a route that takes a list of two method args, "get" and "post" in a list, and then have an if statement to distinguish between code to display the form (get code) and code to process the data on submit (post code), or two separate metho…

In that example I put the form on the '/' route. Here is a GitHub repo with the code:

https://github.com/thinkxl/hn-bottle-example

And here is a gif showing how it works:

https://dsh.re/364b2

Edit: Words.

Re: Ask HN: What Python web programming frameworks and tools are you using?

#16
post #15
post #14

Earlier quoted context omitted.

Where is the code that shows (in the browser) the form for add_entry()? I've used Flask, and for a task like this, you typically have to have either one method which is decorated with a route that takes a list of two method args, "get" and "post" in a list, and then have an if statement to distinguish between code to display the form (get code) and code to process the data on submit (post code), or two separate metho…

In that example I put the form on the '/' route. Here is a GitHub repo with the code: https://github.com/thinkxl/hn-bottle-example And here is a gif showing how it works: https://dsh.re/364b2 Edit: Words.

Okay, will check those out, thanks.
Post reply on HN