Page 18 -
P. 18
table of contents
web development
7 Putting it all together
Sooner or later, you’ll want to share your app with lots of people.
You have many options for doing this. Pop your code on PyPI, send out lots of emails, put
your code on a CD or USB, or simply install your app manually on the computers of those
people who need it. Sounds like a lot of work…not to mention boring. Also, what happens
when you produce the next best version of your code? What happens then? How do
you manage the update? Let’s face it: it’s such a pain that you’ll think up really creative
excuses not to. Luckily, you don’t have to do any of this: just create a webapp instead. And,
as this chapter demonstrates, using Python for web development is a breeze.
It’s good to share 214
You can put your program on the Web 215
What does your webapp need to do? 218
Design your webapp with MVC 221
Model your data 222
View your interface 226
Control your code 234
CGI lets your web server run programs 235
Display the list of athletes 236
The dreaded 404 error! 242
Create another CGI script 244
Enable CGI tracking to help with errors 248
A small change can make all the difference 250
Your webapp’s a hit! 252
Your Python Toolbox 253
xvi