وبلاگ بلیان

Python 3 web development beginner's guide: use Python to create, theme, and deploy unique web applications

معرفی کتاب «Python 3 web development beginner's guide: use Python to create, theme, and deploy unique web applications» نوشتهٔ Anders, Michel، منتشرشده توسط نشر Packt Publishing Limited در سال 2011. این کتاب در 5 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است. «Python 3 web development beginner's guide: use Python to create, theme, and deploy unique web applications» در دستهٔ بدون دسته‌بندی قرار دارد.

'Part of Packt's Beginner's Guide Series, this book follows a sample application, with lots of screenshots, to help you get to grips with the techniques as quickly as possible. Moderately experienced Python programmers who want to learn how to create fairly complex, database-driven, cross browser compatible web apps that are maintainable and look good will find this book of most use. All key technologies except for Python 3 are explained in detail'--EBL Cover 1 Copyright 3 Credits 4 About the Author 5 About the Reviewers 6 www.PacktPub.com 8 Table of Contents 10 Preface 16 Chapter 1: Choosing Your Tools 22 Identifying the components of a web application 22 Time for action – getting an overview of a web application 23 Choosing suitable tools 25 Time for action – choosing a delivery framework, 26 Time for action – choosing a server-side scripting language 27 Time for action – choosing a database engine 29 Time for action – deciding on object relational mappers 30 Time for action – choosing a presentation framework 32 Designing for maintainability and usability 33 Testing 33 Time for action – choosing a test framework 34 Version management 34 Usability 35 Good looking – adhering to common GUI paradigms 35 Themable 36 Cross browser compatible 36 Cross platform compatible 37 Maintainability 37 Standards compliant 37 Security 38 Reliable 38 Robust 38 Access control and authentication 39 Confidentiality 39 Integrity 40 A final word on security 40 Help, I am confused! 40 Time for action – maintaining overview 41 Summary 43 Chapter 2: Creating a Simple Spreadsheet 44 Python 3 45 Time for action – installing Python 3 45 CherryPy 45 Time for action – installing CherryPy 46 Installing jQuery and jQuery UI 46 Serving an application 47 Time for action – serving a dummy application 48 Time for action – serving HTML as dynamic content 49 Who serves what: an overview 51 HTML: separating form and content 52 Time for action – a unit convertor 53 HTML: form based interaction 54 using jQuery UI widgets 55 Time for action – conversion using unitconverter.js 55 jQuery selectors 57 CSS: applying a jQuery UI theme to other elements 58 Time for action – converting a unit convertor into a plugin 60 creating a jQuery UI plugin 61 Designing a spreadsheet application 66 Time for action – serving a spreadsheet application 66 HTML: keeping it simple 67 creating a spreadsheet plugin 67 The missing parts 73 Summary 73 Chapter 3: Tasklist I: Persistence 74 Designing a tasklist application 74 Time for action – creating a logon screen 77 Serving a logon screen 84 Setting up a session 85 Expiring a session 86 Designing a task list 87 Time for action – running tasklist.py 87 Python: the task module 90 Time for action – implementing the task module 91 Adding new tasks 95 Deleting a task 96 tasklist.js 98 Time for action – styling the buttons 98 tooltip.js 100 Time for action – implementing inline labels 101 CSS: tasklist.css 102 Summary 105 Chapter 4: Tasklist II: Databases and AJAX 106 The advantages of a database compared to a filesystem 107 Choosing a database engine 107 Database-driven authentication 108 Time for action – authentication using a database 109 Tasklist II – storing tasks in a database 114 Improving interactivity with AJAX 114 Time for action – getting the time with AJAX 115 Redesigning the Tasklist application 117 Database design 118 Time for action – creating the task database 118 Time for action – retrieving information with select statements 120 TaskDB – interfacing with the database 121 Time for action – connecting to the database 121 Time for action – storing and retrieving information 122 Time for action – updating and deleting information 124 Testing 126 Time for action – testing factorial.py 127 Now what have we gained? 128 Time for action – writing unit tests for tasklistdb.py 129 Designing for AJAX 131 Click handlers 135 The application 136 Time for action - putting it all together 138 Have a go hero - refreshing the itemlist on a regular basis 140 Summary 141 Chapter 5: Entities and Relations 142 Designing a book database 142 The Entity class 143 Time for action – using the Entity class 144 Time for action – creating instances 147 The Relation class 153 Time for action – using the Relation class 153 Relation instances 156 Time for action – defining the Books database 159 The delivery layer 165 Time for action – designing the delivery layer 166 Time for action – adding a new book 177 Auto completion 180 Time for action – using input fields with auto completion 181 The presentation layer 183 Time for action – using an enhanced presentation layer 183 Summary 185 Chapter 6: Building a Wiki 186 The data layer 187 Time for action – designing the wiki data model 187 The delivery layer 190 Time for action – implementing the opening screen 191 The structural components 192 The application methods 194 Time for action – implementing a wiki topic screen 195 Time for action – editing wiki topics 197 Additional functionality 200 Time for action – selecting an image 200 Time for action – implementing a tag cloud 205 Time for action – searching for words 207 The importance of input validation 210 Time for action – scrubbing your content 211 Time for action – rendering content 215 Summary 216 Chapter 7: Refactoring Code for Reuse 218 Time for action – taking a critical look 218 Refactoring 220 Time for action – defining new entities: how it should look 220 Metaclasses 221 Time for action – using metaclasses 222 MetaEntity and AbstractEntity classes 223 Time for action – implementing the MetaEntity and AbstractEntity classes 224 Relations 232 Time for action – defining new relations: how it should look 232 Implementing the MetaRelation and AbstractRelation classes 234 Adding new methods to existing classes 237 Browsing lists of entities 239 Time for action – using a table-based Entity browser 239 Time for action – examining the HTML markup 244 Caching 247 The books application revisited 251 Time for action – creating a books application, take two 251 Summary 257 Chapter 8: Managing Customer Relations 258 A critical review 258 Designing a Customer Relationship Management application 259 Time for action – implementing a basic CRM 259 Adding and editing values 263 Time for action – adding an instance 264 Time for action – editing an instance 266 Adding relations 272 Picklists 274 Time for action – implementing picklists 274 Summary 277 Chapter 9: Creating Full-Fledged Webapps: Implementing Instances 278 Even more relations 278 Time for action – showing one-to-many relationships 279 Time for action – adapting MetaRelation 281 Time for action – enhancing Display 285 Time for action – enhancing Browse 286 Access control 289 Time for action – implementing access control 290 Role-based access control 293 Time for action – implementing role-based access control 294 Summary 298 Chapter 10: Customizing the CRM Application 300 Time for action – sorting 300 Time for action – filtering 305 Customization 307 Time for action – customizing entity displays 307 Time for action – customizing entity lists 313 Time for action – adding a delete button 316 Summary 317 Appendix A: References to Resources 318 Good old offline reference books 318 Additional websites, wikis, and blogs 319 Appendix B: Pop Quiz Answers 322 Chapter 2, Creating a Simple Spreadsheet 322 Chapter 3, Tasklist I: Persistence 323 Chapter 4, Tasklist II: Databases and AJAX 324 Chapter 5, Entities and Relations 325 Chapter 6, Building a Wiki 325 Index 0 Provides Information On Developing Web Sites Using Css. Setting The Foundations -- Visual Formatting Model Recap -- Background Images And Image Replacement -- Styling Links -- Styling Lists And Creating Nav Bars -- Styling Forms And Data Tables -- Layout -- Hacks And Filters -- Bugs And Bug Fixing. Setting The Foundations -- Structuring Your Code -- Use Meaningful Markup -- Ids And Class Names -- Divs And Spans -- Document Types, Doctype Switching, And Browser Modes -- Validation -- Browser Modes -- Doctype Switching -- Getting Your Styles To Hit The Target -- Common Selectors -- Pseudo-classes -- The Universal Selector -- Advanced Selectors -- Child And Adjacent Sibling Selectors -- Attribute Selectors -- The Cascade And Specificity -- Specificity -- Using Specificity In Your Stylesheets -- Adding A Class Or An Id To The Body Tag -- Inheritance -- Planning, Organizing, And Maintaining Your Stylesheets -- Applying Styles To Your Document -- Commenting Your Code -- Adding Structural Comments -- Note To Self -- Removing Comments And Optimizing Your Stylesheets -- Style Guides -- Organizing Your Stylesheets For Easy Maintenance -- Visual Formatting Model Recap -- Box Model Recap -- Ie/win And The Box Model -- Margin Collapsing -- Positioning Recap --^ The Visual Formatting Model -- Relative Positioning -- Absolute Positioning -- Fixed Positioning -- Floating -- Line Boxes And Clearing -- Background Images And Image Replacement -- Background Image Basics -- Rounded-corner Boxes -- Fixed-width Rounded-corner Boxes -- Flexible Rounded-corner Box -- Mountaintop Corners -- Drop Shadows -- Easy Css Drop Shadows -- Drop Shadows A La Clagnut -- Fuzzy Shadows -- Onion Skinned Drop Shadows -- Image Replacement -- Fahrner Image Replacement (fir) -- Phark -- Gilder/levin Method -- Inman Flash Replacement (ifr) And Scalable Inman Flash Replacement (sifr) -- Styling Links -- Simple Link Styling -- Fun With Underlines -- Fancy Link Underlines -- Highlighting Different Types Of Link -- Highlighting Downloadable Documents And Feeds -- Creating Buttons And Rollovers -- Simple Rollovers -- Rollovers With Images -- Pixy-style Rollovers -- Visited-link Styles -- Pure Css Tooltips -- Styling Lists And Creating Nav Bars -- Basic List Styling --^ Creating A Vertical Nav Bar -- Highlighting The Current Page In A Nav Bar -- Creating A Horizontal Nav Bar -- Simplified Sliding Doors Tabbed Navigation -- Css Image Maps -- Flickr-style Image Maps -- Remote Rollovers -- A Short Note About Definition Lists -- Styling Forms And Data Tables -- Styling Data Tables -- Table-specific Elements -- Summary And Caption -- Thead, Tbody, And Tfoot -- Col And Colgroups -- Data Table Markup -- Styling The Table -- Adding The Visual Style -- Added Extras -- Simple Form Layout -- Useful Form Elements -- Form Labels -- The Basic Layout -- Other Elements -- Embellishments -- Required Fields -- Complicated Form Layout -- Accessible Date Input -- Multicolumn Check Boxes -- Form Feedback -- Layout -- Centering A Design -- Centering A Design Using Auto Margins -- Centering A Design Using Positioning And Negative Margins -- Float-based Layout -- Two-column Floated Layout -- Three-column Floated Layout -- Fixed-width, Liquid, And Elastic Layout --^ Liquid Layouts -- Elastic Layouts -- Elastic-liquid Hybrid -- Liquid And Elastic Images -- Faux Columns -- Hacks And Filters -- An Introduction To Hacks And Filters -- A Warning About Hacks And Filters -- Using Hacks Sensibly -- Filtering Separate Stylesheets -- Internet Explorer Conditional Comments -- Band Pass Filters -- Filtering Individual Rules And Declarations -- The Child Selector Hack -- Attribute Selector Hack -- The Star Html Hack -- Ie/mac Commented Backslash Hack -- The Escaped Property Hack -- Tantek's Box Model Hack -- The Modified Simplified Box Model Hack -- The Limportant And Underscore Hacks -- The Owen Hack -- Bugs And Bug Fixing -- Bug Hunting -- Common Css Problems -- Problems With Specificity And Sort Order -- Problems With Margin Collapsing -- Bug Hunting Basics -- Isolate The Problem -- Creating A Minimal Test Case -- Fix The Problem, Not The Symptoms -- Ask For Help -- Having Layout -- What Is Layout? -- What Effect Does Layout Have? --^ Common Bugs And Their Fixes -- Double-margin Float Bug -- Three-pixel Text Jog Bug -- Ie 6 Duplicate Character Bug -- Ie 6 Peek-a-boo Bug -- Absolute Positioning In A Relative Container -- Stop Picking On Internet Explorer -- More Than Doodles -- About This Case Study -- Controlling Content Area With Descendant Selectors -- The Xhtml -- A Note About Naming Conventions -- Three-column Layout -- Two-column Layout -- One-column Layout -- Removing Unwanted Columns -- Floating The Columns -- The Calculations -- Floating The Columns In The Right Place -- Highlighting The Current Page Based On The Body Class -- Drop-in Boxes For Columns -- Right-angled Or Rounded Corners-you Decide -- Flat, Right-angled Corners -- So, Let's Prepare For Something Special -- Transparent Custom Corners And Borders -- The Images -- The Css -- Combining Classes For Targeted Actions -- Image Classes And Exceptions -- Default Images -- Owned Images -- Larger Images -- Dealing With Links --^ Understanding The Sidebar Links -- Checked-off Visited Links -- Lahv, Not Lvha -- Highlighting External Links -- Floated Drop Shadows (gallery) -- Casting The Shadows -- Floating The Images -- Tuscany Luxury Resorts -- About This Case Study -- The Fluid Layout -- Body And Container -- Masthead -- Content And Sidebar -- Fluid Properties -- Footer -- Resolving Fluid Layout Issues -- Aligning Elements Using Absolute Positioning -- Location Properties (top, Bottom, Left, Right) -- Stacking Order (z-index) -- Background Image Techniques -- Dividing The Top In Three -- Bulletproofing A Background -- Image Replacement -- Logo Image Replacement -- Initial Cap Image Replacement -- Fluid Imagery -- Coding A Fluid Image -- Using A Single List Item For Multiple Elements -- Coding The Menu. Andy Budd ; With Cameron Moll And Simon Collison. Includes Index.

In Detail

CherryPy is a Python library for web development that allows developers to build web applications in the same way as any other object-oriented Python program. Enriched by several years of active development, it has become one of the most established toolkits for building solid and high-performance web applications in Python. CherryPy abstracts the complex low-level HTTP protocol into an easy-to-use interface that respects Python idioms. The library aims at being simple to learn for a beginner while offering the most advanced features to fluent Python developers. For these reasons CherryPy was chosen to be at the heart of the popular and feature-rich TurboGears web framework. CherryPy-powered web applications are stand-alone Python applications with their own embedded multi-threaded web server, but can also run behind Apache or IIS for scalability.

This book covers the CherryPy library for Python web development from its history and installation through its main features and core concepts to its integration with Python and other products to construct, test, and deploy a sample photoblog application. The author Sylvain Hellegouarch is dedicated to the development of free software projects and has been coordinating and administrating the community efforts around the CherryPy project since 2004. The approach based on an example application introduces many other common Python libraries, providing transferable skills also relevant for non-web Python projects.

Approach

The book starts with two chapters dedicated to CherryPy, its history and installation. It then moves through a gentle introduction to the main features and concepts of CherryPy to a thorough review of its core capabilities. After laying this foundation the book dives into a real-world example, detailing important steps in the creation of a photoblog application. These chapters cover database manipulation via Object Relational Mapping (ORM), using web services to enhance the application, and client-side scripting through AJAX. Finally, the book covers the need for unit, functional, and performance testing before closing with deployment solutions for a CherryPy-based application.

Who this book is for

This book is principally geared towards Python web developers, who are looking to add the power of the CherryPy library to their existing Python skillset. It assumes a good working knowledge of Python. Although the CherryPy toolkit is at the core of the book, many other common libraries are introduced

This book is your indispensable guide to cutting-edge CSS developmentall you need to work your way up to CSS professional. You'll learn how to: - Plan, organize, and maintain your stylesheets more effectively - Apply the secrets of liquid, elastic, and hybrid layouts - Create flickr-style image maps, remote rollovers, and other advanced CSS features - Lay out forms using pure CSS - Recognize common browser bugs, and how to fix them While CSS is a relatively simple technology to learn, it is a difficult one to master. When you first start developing sites using CSS, you will come across all kinds of infuriating browser bugs and inconsistencies. It sometimes feels like there are a million and one different techniques to master, spread across a bewildering array of websites. The range of possibilities seems endless and makes for a steep and daunting learning curve. By bringing all of the latest tips, tricks, and techniques together in one handy reference, this book demystifies the secrets of CSS and makes the journey to CSS mastery as simple and painless as possible. While most books concentrate on basic skills, this one is different, assuming that you already know the basics and why you should be using CSS in your work, and concentrating mainly on advanced techniques. It begins with a brief recap of CSS fundamentals such as the importance of meaningful markup, how to structure and maintain your code, and how the CSS layout model really works. With the basics out of the way, each subsequent chapter details a particular aspect of CSS-based design. Through a series of easy-to-follow tutorials, you will learn practical CSS techniques you can immediately start using in your daily work. Browser inconsistencies are the thorn in most CSS developers' sides, so we have dedicated two whole chapters to CSS hacks, filters, and bug fixing, as well as looking at image replacement; professional link, form, and list styling; pure CSS layouts; and much more. All of these techniques are then put into practice in two beautifully designed case studies, written by two of the world's best CSS designers, Simon Collison and Cameron Moll. Summary of Contents: - Chapter 1: Setting the Foundations - Chapter 2: Visual Formatting Model Recap - Chapter 3: Background Images and Image Replacement - Chapter 4: Styling Links - Chapter 5: Styling Lists and Creating Nav Bars - Chapter 6: Styling Forms and Data Tables - Chapter 7: Layout - Chapter 8: Hacks and Filters - Chapter 9: Bugs and Bug Fixing - Case Study 1: More Than Doodles - Case Study 2: Tuscany Luxury Resorts

In Detail

Blender 3D is a popular, open source modeling package that can produce photo-realistic 3D images and animations. Automating tasks and extending the functionality of an extensive application like Blender will streamline your workflow and make the impossible possible. However, implementing scripts may be daunting.

This book takes a practical step-by-step approach to implementing Python scripts that cover almost all areas of Blender. It clearly outlines each problem and focuses on straightforward, easy-to-understand code, highlighting the common pitfalls and Blender idiosyncrasies. It guides you from the installation process and the creation of a simple object to elaborate, fully rigged models with vertex groups and materials all the way to extending Blender's built-in editor. It also teaches how to implement a simple web server inside Blender to serve rendered images. This book will take you from a clear problem description to a fully functional program. The focus is on finding your way in Blender's vast array of possibilities and getting things done without losing too much time on programming details. Each script is carefully explained to provide insight that can be reused in other projects.

This practical book will help you gain control over all the aspects of Blender using the Python programming language

Approach

The focus of the book is on practical problems and how to solve them in Python. The examples given are useful programs that try to solve real-world needs. Each chapter revolves around a single concept giving several examples gradually growing in difficulty. Each section analyses the problem first before diving into coding and gives extensive background information to enable the reader to generalize from the specific problem to a wider range of challenges. The sample code is provided as fully working examples with all key issues extensively highlighted. All sample programs are clear and concise yet nothing essential is left out and the programming style focuses on readability rather than on stylistic rigor or efficiency.

Who this book is for

This book is for users comfortable with Blender as a modeling and rendering tool who want to expand their skills to include Blender scripting to automate laborious tasks and achieve results otherwise impossible. Blender experience is essential as is some experience in Python programming.

In Detail Blender 3D is a popular, open source modeling package that can produce photo-realistic 3D images and animations. Automating tasks and extending the functionality of an extensive application like Blender will streamline your workflow and make the impossible possible. However, implementing scripts may be daunting. This book takes a practical step-by-step approach to implementing Python scripts that cover almost all areas of Blender. It clearly outlines each problem and focuses on straightforward, easy-to-understand code, highlighting the common pitfalls and Blender idiosyncrasies. It guides you from the installation process and the creation of a simple object to elaborate, fully rigged models with vertex groups and materials all the way to extending Blender's built-in editor. It also teaches how to implement a simple web server inside Blender to serve rendered images. This book will take you from a clear problem description to a fully functional program. The focus is on finding your way in Blender's vast array of possibilities and getting things done without losing too much time on programming details. Each script is carefully explained to provide insight that can be reused in other projects. This practical book will help you gain control over all the aspects of Blender using the Python programming language Approach The focus of the book is on practical problems and how to solve them in Python. The examples given are useful programs that try to solve real-world needs. Each chapter revolves around a single concept giving several examples gradually growing in difficulty. Each section analyses the problem first before diving into coding and gives extensive background information to enable the reader to generalize from the specific problem to a wider range of challenges. The sample code is provided as fully working examples with all key issues extensively highlighted. All sample programs are clear and concise yet nothing essential is left out and the programming style focuses on readability rather than on stylistic rigor or efficiency. Who this book is for This book is for users comfortable with Blender as a modeling and rendering tool who want to expand their skills to include Blender scripting to automate laborious tasks and achieve results otherwise impossible. Blender experience is essential as is some experience in Python programming.

In Detail

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.

Python 3 Web Development Beginner's Guide 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.

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.

A practical guide to building and customizing your own Python web application, without the restriction of a pre-defined framework

Approach

Part of Packt's Beginner's Guide Series, this book follows a sample application, with lots of screenshots, to help you get to grips with the techniques as quickly as possible.

Who this book is for

Moderately experienced Python programmers who want to learn how to create fairly complex, database-driven, cross browser compatible web apps that are maintainable and look good will find this book of most use. All key technologies except for Python 3 are explained in detail.

Annotation Automated testing moves much of the labor of testing off the developer and makes it easier as well as quicker to find bugs and fix them. Automated tests run faster, increase test coverage, and lower costs. However, testing is neither an easy process nor remotely exciting for most developers. But with the right techniques and tools, testing can become a simple and gratifying part of the development process. With this helpful guide _ from an expert _ in your hand, testing will not be a tiresome topic for you anymore. You will learn how to test your Python projects in the easiest way, making other parts of the development process easier and more enjoyable. This book covers the tools and techniques of automated testing and test-driven development. Starting from the very basics, the chapters introduce new tools and techniques in simple, accessible language with step-by-step examples. You will explore how to make testing easier and more accurate with Python's doctest module and learn test-driven development using the unittest framework. You will also learn how to keep your units separate from each other and discover a simple and easy way to integrate Mocker and unittest. Next, we cover integration testing and web application testing. Automated testing gives developers better feedback, faster and more often. Bugs get found sooner and fixed better, with less effort. By the end of this book, you will have all of the skills needed to benefit from automated testing Annotation 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. Python 3 Web Development Beginner's Guide 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. 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. A practical guide to building and customizing your own Python web application, without the restriction of a pre-defined framework The book begins with the very foundations of automated testing, and expands on them until the best-practice tools and techniques are fully covered. New concepts are illustrated with step-by-step hands-on exercises. Testing will be easier and more enjoyable with this beginner's guide. If you are a Python developer and want to write tests for your applications, this book will get you started and show you the easiest way to learn testing. You need to have sound Python programming knowledge to follow along. An awareness of software testing would be good, but no formal knowledge of testing is expected nor do you need to have any knowledge of the libraries discussed in the book.
دانلود کتاب Python 3 web development beginner's guide: use Python to create, theme, and deploy unique web applications