09.11.2016 Views

Foundations of Python Network Programming 978-1-4302-3004-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 11 ■ WEB APPLICATIONS<br />

web applications by selecting and configuring a middleware stack that got the application's boilerplate<br />

logic out <strong>of</strong> the way.<br />

<strong>Python</strong> web frameworks are crucial to modern web development. They handle much <strong>of</strong> the logic <strong>of</strong><br />

HTTP, and they also provide several important abstractions: they can dispatch different URLs to<br />

different <strong>Python</strong> code, insert <strong>Python</strong> variables into HTML templates, and provide important assistance<br />

in both persisting <strong>Python</strong> objects to the database and also in letting them be accessed from the web both<br />

through user-facing CRUD interfaces as well as RESTful web-service protocols.<br />

There do exist pure-<strong>Python</strong> web servers, which can be especially important when writing a web<br />

interface for a program that users will install locally. There are not only good choices available for<br />

download, but a few small servers are even built into the <strong>Python</strong> Standard Library.<br />

Two old approaches to dynamic web page generation are the CGI protocol and the mod_python<br />

Apache module. Neither should be used for new development.<br />

196

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!