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

Time for action – putting it all together


Now that we have all the requisite components in place (that is, tasklistdb.py, taskapp.py, and tasklistajax.js), it is straightforward to put them together. If you run the code below (available as tasklist.py) and point your browser at http://localhost:8080/ , you will get a familiar looking login screen and after entering some credentials (username admin and password admin are configured by default) the resulting screen will look almost the same as the application we developed in the previous chapter, as illustrated in the following screenshot:

What just happened?

For the CherryPy application, we need a root class that can act as the root of the tree of pages we serve the user. Again, we call this class simply Root and assign an instance of our TaskApp application to the task variable and an instance of the LogonDB application to the logon variable (highlighted in the code below). Together with the index() method, this will create a tree of pages...