Book Image

Python 3 Web Development Beginner's Guide

By : Michel Anders
Book Image

Python 3 Web Development Beginner's Guide

By: Michel Anders

Overview of this book

<p>Building your own Python web applications provides you with the opportunity to have great functionality, with no restrictions. However, creating web applications with Python is not straightforward. Coupled with learning a new skill of developing web applications, you would normally have to learn how to work with a framework as well.</p> <p><em>Python 3 Web Development Beginner's Guide</em> shows you how to independently build your own web application that is easy to use, performs smoothly, and is themed to your taste – all without having to learn another web framework.</p> <p>Web development can take time and is often fiddly to get right. This book will show you how to design and implement a complex program from start to finish. Each chapter looks at a different type of web application, meaning that you will learn about a wide variety of features and how to add them to your custom web application. You will also learn to implement jQuery into your web application to give it extra functionality. By using the right combination of a wide range of tools, you can have a fully functional, complex web application up and running in no time.</p>
Table of Contents (19 chapters)
Python 3 Web Development Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 2, Creating a Simple Spreadsheet


Serving content with CherryPy

Answer:

Rename the index() method to content()

Remember that in order to serve the content referred to by a URL such as http://127.0.0.1/content, CherryPy looks for a method named content() in the object instance passed to the quickstart() function. Later on, we will see that it is also possible to build hierarchies of classes that enable CherryPy to serve URLs like http://127.0.0.1/app/toplevel/content as well.

Adding an icon to a button

Answer:

$("button").button({icons: {primary: 'ui-icon-refresh'}})

Like many jQuery and jQuery UI plugins, the button widget takes an options object as an argument. This options object may have a number of attributes, one of them—the icons attribute. The value of this attribute itself is an object again, its primary attribute determining which of the many standard icons will be displayed on the button. Refer to the online documentation of the button widget to see all options: http://jqueryui.com/demos/button/ and check jQuery UI's themeroller page at http://jqueryui.com/themeroller/ for an overview of all available icons for a given theme.

Adding conversions to a unitconverter instance

Answer:

$("#example").unitconverter({'cubic feet_litres':1.0/28.3168466 })

Changing option defaults

Answer: b