Mastering Flask Web Development Second Edition

Total Page:16

File Type:pdf, Size:1020Kb

Mastering Flask Web Development Second Edition Mastering Flask Web Development Second Edition Build enterprise-grade, scalable Python web applications Daniel Gaspar Jack Stouffer BIRMINGHAM - MUMBAI Mastering Flask Web Development Second Edition Copyright © 2018 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Commissioning Editor: Amarabha Banerjee Acquisition Editor: Devanshi Doshi Content Development Editor: Onkar Wani Technical Editor: Diksha Wakode Copy Editor: Safis Editing Project Coordinator: Sheejal Shah Proofreader: Safis Editing Indexer: Rekha Nair Graphics: Alishon Mendonsa Production Coordinator: Aparna Bhagat First published: September 2015 Second Edition: October 2018 Production reference: 1301018 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78899-540-5 www.packtpub.com mapt.io Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website. Why subscribe? Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals Improve your learning with Skill Plans built especially for you Get a free eBook or video every month Mapt is fully searchable Copy and paste, print, and bookmark content Packt.com Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. Contributors About the authors Daniel Gaspar is a programmer and DevOps engineer with more than 20 years' experience. He has worked in a wide range of sectors, including government and finance. He is currently working at Miniclip (the global leader in digital games). He uses a wide range of tools in his daily work, but Flask caught his attention because of its excellently designed API and simplicity. Daniel is an OSS and Python enthusiast, and has developed a widely used extension/framework named Flask-AppBuilder, used by Airbnb on Superset and AirFlow. First, I would like to thank my wife, Susana, and my beautiful children, Mariana and Pedro, for their amazing support, enthusiasm, and patience. Also, a big thank you to everyone at Packt Publishing, especially to Onkar Wani, with whom it was a pleasure to work. Jack Stouffer is a programmer who has several years of experience in designing web applications. He switched to Flask two years ago for all his projects. He currently works for Apollo America in Auburn Hills, Michigan and writes internal business tools and software using Python, Flask, and JavaScript. Jack is a believer and supporter of open source technology. When he released his Flask examples with the recommended best practices on GitHub, it became one of the most popular Flask repositories on the site. Jack has also worked as a reviewer for Flask Framework Cookbook, Packt. About the reviewer Damyan Bogoev is based in Bulgaria, where he currently works at Gtmhub as a software engineer. Prior to Gtmhub, Damyan worked at Telerik. His background is in developing backend server applications and tools for infrastructure automation, management, and monitoring. Damyan is also technical reviewer for the Web API Development with Flask video course. Packt is searching for authors like you If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Table of Contents Preface 1 Chapter 1: Getting Started 6 Version control with Git 7 Installing Git 7 Git on Windows 7 Git basics 7 Git branches and flow 11 Python package management with pip 15 Installing the Python package manager on Windows 15 Installing pip Python package manager on macOS X and Linux 16 Pip basics 17 Dependency sandboxing with virtualenv 18 Virtualenv basics 19 Setting up Docker 19 The beginning of our project 20 Simple application 21 Project structure 22 Using Flask's command-line interface 22 Summary 23 Chapter 2: Creating Models with SQLAlchemy 24 Setting up SQLAlchemy 25 Python packages 25 Flask SQLAlchemy 26 Our first model 26 Creating the user table 29 CRUD 30 Creating models 30 Reading models 30 Filtering queries 32 Updating models 34 Deleting models 34 Relationships between models 34 One-to-many relationship 35 Many-to-many relationship 38 Constraints and indexing 40 The convenience of SQLAlchemy sessions 42 Database migrations with Alembic 43 Summary 46 Table of Contents Chapter 3: Creating Views with Templates 47 Jinja's syntax 47 Filters 48 The default filter 49 The escape filter 49 The float filter 49 The int filter 49 The join filter 50 The length filter 50 The round filter 50 The safe filter 51 The title filter 51 The tojson filter 51 The truncate filter 52 Custom filters 52 Comments 53 Using if statements 53 Loops 53 Macros 55 Flask-specific variables and functions 55 The config object 56 The request object 56 The session object 56 The url_for() function 56 The get_flashed_messages() function 57 Creating our views 58 The view function 58 Writing the templates and inheritance 60 The base template 61 The child templates 64 Writing the other templates 67 Flask WTForms 68 WTForms basics 69 Custom validations 70 Posting comments 71 Summary 74 Chapter 4: Creating Controllers with Blueprints 75 Sessions and globals 75 Request setup and teardown 76 Error pages 77 Class-based views 78 Method class views 81 Blueprints 81 Summary 84 Chapter 5: Advanced Application Structure 85 [ ii ] Table of Contents Modular application 85 Refactoring the code 87 Application factories 89 Summary 91 Chapter 6: Securing Your App 92 Authentication methods 93 Basic authentication 93 Remote-user authentication 94 LDAP authentication 95 Database user model authentication 97 OpenID and OAuth 97 Flask-Login overview 100 Setting up 101 Updating the models 103 Creating the forms 106 Protecting your form from spam 107 Creating views 109 OpenID 114 OAuth 117 Role-based access control (RBAC) 119 Summary 122 Chapter 7: Using NoSQL with Flask 123 Types of NoSQL database 124 Key-value stores 124 Document stores 125 Column family stores 125 Graph databases 128 RDBMS versus NoSQL 129 The strengths of RDBMS databases 129 Data integrity 130 Speed and scale 130 Tools 131 The strengths of NoSQL databases 131 CAP theorem 132 What database to use and when 135 MongoDB in Flask 136 Installing MongoDB 136 Setting up MongoEngine 137 Defining documents 138 Field types 139 Types of documents 141 The meta attribute 141 CRUD 143 Create 143 [ iii ] Table of Contents Write safety 144 Read 144 Filtering 146 Update 147 Delete 148 Relationships in NoSQL 148 One-to-many relationships 149 Many-to-many relationships 150 Leveraging the power of NoSQL 151 Summary 156 Chapter 8: Building RESTful APIs 157 What is REST? 157 HTTP 158 REST definition and best practices 160 Setting up a RESTful Flask API 164 JWT authentication 167 Get requests 170 Output formatting 170 Request arguments 173 Post requests 176 Put requests 178 Delete requests 180 Summary 180 Chapter 9: Creating Asynchronous Tasks with Celery 181 What is Celery? 182 Setting up Celery and RabbitMQ 183 Creating tasks in Celery 185 Running Celery tasks 189 Celery workflows 190 Partials 191 Callbacks 191 Group 192 Chain 192 Chord 193 Running tasks periodically 193 Monitoring Celery 195 Web-based monitoring with Flower 196 Creating a reminder app 198 Creating a weekly digest 199 Summary 202 Chapter 10: Useful Flask Extensions 203 Flask CLI 203 Flask Debug Toolbar 206 [ iv ] Table of Contents Flask Caching 208 Caching views and functions 209 Caching functions with parameters 210 Caching routes with query strings 211 Using Redis as a cache backend 212 Using memcached as a cache backend 213 Flask Assets 214 Flask Admin 216 Creating basic admin pages 218 Creating database admin pages 220 Enhancing administration for the post page 221 Creating file system admin pages 224 Securing Flask Admin 224 Flask-Babel 225 Flask Mail 229 Summary 230 Chapter 11: Building Your Own Extension 231 Creating a YouTube Flask extension 231 Creating a Python package 234 Creating
Recommended publications
  • Cubes Documentation Release 1.0.1
    Cubes Documentation Release 1.0.1 Stefan Urbanek April 07, 2015 Contents 1 Getting Started 3 1.1 Introduction.............................................3 1.2 Installation..............................................5 1.3 Tutorial................................................6 1.4 Credits................................................9 2 Data Modeling 11 2.1 Logical Model and Metadata..................................... 11 2.2 Schemas and Models......................................... 25 2.3 Localization............................................. 38 3 Aggregation, Slicing and Dicing 41 3.1 Slicing and Dicing.......................................... 41 3.2 Data Formatters........................................... 45 4 Analytical Workspace 47 4.1 Analytical Workspace........................................ 47 4.2 Authorization and Authentication.................................. 49 4.3 Configuration............................................. 50 5 Slicer Server and Tool 57 5.1 OLAP Server............................................. 57 5.2 Server Deployment.......................................... 70 5.3 slicer - Command Line Tool..................................... 71 6 Backends 77 6.1 SQL Backend............................................. 77 6.2 MongoDB Backend......................................... 89 6.3 Google Analytics Backend...................................... 90 6.4 Mixpanel Backend.......................................... 92 6.5 Slicer Server............................................. 94 7 Recipes 97 7.1 Recipes...............................................
    [Show full text]
  • Preview Turbogears Tutorial
    TurboGears About the Tutorial TurboGears is a Python web application framework, which consists of many modules. It is designed around the MVC architecture that are similar to Ruby on Rails or Struts. TurboGears are designed to make rapid web application development in Python easier and more supportable. TurboGears is a web application framework written in Python. TurboGears follows the Model-View-Controller paradigm as do most modern web frameworks like Rails, Django, Struts, etc. This is an elementary tutorial that covers all the basics of TurboGears. Audience This tutorial has been designed for all those readers who want to learn the basics of TurboGears. It is especially going to be useful for all those Web developers who are required to simplify complex problems and create single database backed webpages. Prerequisites We assume the readers of this tutorial have a basic knowledge of web application frameworks. It will be an added advantage if the readers have hands-on experience of Python programming language. In addition, it is going to also help if the readers have an elementary knowledge of Ruby-on-Rails and Struts. Disclaimer & Copyright Copyright 2016 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors.
    [Show full text]
  • An Online Analytical Processing Multi-Dimensional Data Warehouse for Malaria Data S
    Database, 2017, 1–20 doi: 10.1093/database/bax073 Original article Original article An online analytical processing multi-dimensional data warehouse for malaria data S. M. Niaz Arifin1,*, Gregory R. Madey1, Alexander Vyushkov2, Benoit Raybaud3, Thomas R. Burkot4 and Frank H. Collins1,4,5 1Department of Computer Science and Engineering, University of Notre Dame, Notre Dame, Indiana, USA, 2Center for Research Computing, University of Notre Dame, Notre Dame, Indiana, USA, 3Institute for Disease Modeling, Bellevue, Washington, USA, 4Australian Institute of Tropical Health and Medicine, James Cook University, Cairns, Queensland, Australia 5Department of Biological Sciences, University of Notre Dame, Notre Dame, Indiana, USA *Corresponding author: Tel: þ1 574 387 9404; Fax: 1 574 631 9260; Email: sarifi[email protected] Citation details: Arifin,S.M.N., Madey,G.R., Vyushkov,A. et al. An online analytical processing multi-dimensional data warehouse for malaria data. Database (2017) Vol. 2017: article ID bax073; doi:10.1093/database/bax073 Received 15 July 2016; Revised 21 August 2017; Accepted 22 August 2017 Abstract Malaria is a vector-borne disease that contributes substantially to the global burden of morbidity and mortality. The management of malaria-related data from heterogeneous, autonomous, and distributed data sources poses unique challenges and requirements. Although online data storage systems exist that address specific malaria-related issues, a globally integrated online resource to address different aspects of the disease does not exist. In this article, we describe the design, implementation, and applications of a multi- dimensional, online analytical processing data warehouse, named the VecNet Data Warehouse (VecNet-DW). It is the first online, globally-integrated platform that provides efficient search, retrieval and visualization of historical, predictive, and static malaria- related data, organized in data marts.
    [Show full text]
  • Interfacing Apache HTTP Server 2.4 with External Applications
    Interfacing Apache HTTP Server 2.4 with External Applications Jeff Trawick Interfacing Apache HTTP Server 2.4 with External Applications Jeff Trawick November 6, 2012 Who am I? Interfacing Apache HTTP Server 2.4 with External Applications Met Unix (in the form of Xenix) in 1985 Jeff Trawick Joined IBM in 1990 to work on network software for mainframes Moved to a different organization in 2000 to work on Apache httpd Later spent about 4 years at Sun/Oracle Got tired of being tired of being an employee of too-huge corporation so formed my own too-small company Currently working part-time, coding on other projects, and taking classes Overview Interfacing Apache HTTP Server 2.4 with External Applications Jeff Trawick Huge problem space, so simplify Perspective: \General purpose" web servers, not minimal application containers which implement HTTP \Applications:" Code that runs dynamically on the server during request processing to process input and generate output Possible web server interactions Interfacing Apache HTTP Server 2.4 with External Applications Jeff Trawick Native code plugin modules (uhh, assuming server is native code) Non-native code + language interpreter inside server (Lua, Perl, etc.) Arbitrary processes on the other side of a standard wire protocol like HTTP (proxy), CGI, FastCGI, etc. (Java and \all of the above") or private protocol Some hybrid such as mod fcgid mod fcgid as example hybrid Interfacing Apache HTTP Server 2.4 with External Applications Jeff Trawick Supports applications which implement a standard wire protocol, no restriction on implementation mechanism Has extensive support for managing the application[+interpreter] processes so that the management of the application processes is well-integrated with the web server Contrast with mod proxy fcgi (pure FastCGI, no process management) or mod php (no processes/threads other than those of web server).
    [Show full text]
  • Python for Bioinformatics, Second Edition
    PYTHON FOR BIOINFORMATICS SECOND EDITION CHAPMAN & HALL/CRC Mathematical and Computational Biology Series Aims and scope: This series aims to capture new developments and summarize what is known over the entire spectrum of mathematical and computational biology and medicine. It seeks to encourage the integration of mathematical, statistical, and computational methods into biology by publishing a broad range of textbooks, reference works, and handbooks. The titles included in the series are meant to appeal to students, researchers, and professionals in the mathematical, statistical and computational sciences, fundamental biology and bioengineering, as well as interdisciplinary researchers involved in the field. The inclusion of concrete examples and applications, and programming techniques and examples, is highly encouraged. Series Editors N. F. Britton Department of Mathematical Sciences University of Bath Xihong Lin Department of Biostatistics Harvard University Nicola Mulder University of Cape Town South Africa Maria Victoria Schneider European Bioinformatics Institute Mona Singh Department of Computer Science Princeton University Anna Tramontano Department of Physics University of Rome La Sapienza Proposals for the series should be submitted to one of the series editors above or directly to: CRC Press, Taylor & Francis Group 3 Park Square, Milton Park Abingdon, Oxfordshire OX14 4RN UK Published Titles An Introduction to Systems Biology: Statistical Methods for QTL Mapping Design Principles of Biological Circuits Zehua Chen Uri Alon
    [Show full text]
  • The Turbogears Toolbox and Other Tools
    19 The TurboGears Toolbox and Other Tools In This Chapter ■ 19.1 Toolbox Overview 372 ■ 19.2 ModelDesigner 373 ■ 19.3 CatWalk 375 ■ 19.4 WebConsole 377 ■ 19.5 Widget Browser 378 ■ 19.6 Admi18n and System Info 379 ■ 19.7 The tg-admin Command 380 ■ 19.8 Other TurboGears Tools 380 ■ 19.9 Summary 381 371 226Ramm_ch19i_indd.indd6Ramm_ch19i_indd.indd 337171 110/17/060/17/06 111:50:421:50:42 AAMM urboGears includes a number of nice features to make your life as a de- Tveloper just a little bit easier. The TurboGears Toolbox provides tools for creating and charting your database model, adding data to your database with a web based GUI while you are still in development, debugging system problems, browsing all of the installed widgets, and internationalizing your application. 19.1 Toolbox Overview The TurboGears Toolbox is started with the tg-admin toolbox command. Your browser should automatically pop up when you start the Toolbox, but if it doesn’t you should still be able to browse to http://localhost:7654, where you’ll see a web page with links for each of the tools in the toolbox (as seen in Figure 19.1). FIGURE 19.1 The TurboGears Toolbox home page Each of the components in the Toolbox is also a TurboGears application, so you can also look at them as examples of how TurboGears applications are built. 372 226Ramm_ch19i_indd.indd6Ramm_ch19i_indd.indd 337272 110/17/060/17/06 111:50:431:50:43 AAMM 19.2 ModelDesigner 373 Because there isn’t anything in TurboGears that can’t be done in code or from the command line, the use of the Toolbox is entirely optional.
    [Show full text]
  • Uwsgi Documentation Release 2.0
    uWSGI Documentation Release 2.0 uWSGI Jun 17, 2020 Contents 1 Included components (updated to latest stable release)3 2 Quickstarts 5 3 Table of Contents 33 4 Tutorials 303 5 Articles 343 6 uWSGI Subsystems 375 7 Scaling with uWSGI 457 8 Securing uWSGI 485 9 Keeping an eye on your apps 503 10 Async and loop engines 511 11 Web Server support 525 12 Language support 541 13 Other plugins 629 14 Broken/deprecated features 633 15 Release Notes 643 16 Contact 741 17 Commercial support 743 18 Donate 745 19 Sponsors 747 20 Indices and tables 749 i Python Module Index 751 Index 753 ii uWSGI Documentation, Release 2.0 The uWSGI project aims at developing a full stack for building hosting services. Application servers (for various programming languages and protocols), proxies, process managers and monitors are all implemented using a common api and a common configuration style. Thanks to its pluggable architecture it can be extended to support more platforms and languages. Currently, you can write plugins in C, C++ and Objective-C. The “WSGI” part in the name is a tribute to the namesake Python standard, as it has been the first developed plugin for the project. Versatility, performance, low-resource usage and reliability are the strengths of the project (and the only rules fol- lowed). Contents 1 uWSGI Documentation, Release 2.0 2 Contents CHAPTER 1 Included components (updated to latest stable release) The Core (implements configuration, processes management, sockets creation, monitoring, logging, shared memory areas, ipc, cluster membership and the uWSGI Subscription Server) Request plugins (implement application server interfaces for various languages and platforms: WSGI, PSGI, Rack, Lua WSAPI, CGI, PHP, Go .
    [Show full text]
  • An Analysis of Python's Topics, Trends, and Technologies Through Mining Stack Overflow Discussions
    1 An Analysis of Python’s Topics, Trends, and Technologies Through Mining Stack Overflow Discussions Hamed Tahmooresi, Abbas Heydarnoori, and Alireza Aghamohammadi F Abstract—Python is a popular, widely used, and general-purpose pro- (LDA) [3] to categorize discussions in specific areas such gramming language. In spite of its ever-growing community, researchers as web programming [4], mobile application development [5], have not performed much analysis on Python’s topics, trends, and tech- security [6], and blockchain [7]. However, none of them has nologies which provides insights for developers about Python commu- focused on Python. In this study, we shed light on the nity trends and main issues. In this article, we examine the main topics Python’s main areas of discussion through mining 2 461 876 related to this language being discussed by developers on one of the most popular Q&A websites, Stack Overflow, as well as temporal trends posts, from August 2008 to January 2019, using LDA based through mining 2 461 876 posts. To be more useful for the software topic modeling . We also analyze the temporal trends of engineers, we study what Python provides as the alternative to popular the extracted topics to find out how the developers’ interest technologies offered by common programming languages like Java. is changing over the time. After explaining the topics and Our results indicate that discussions about Python standard features, trends of Python, we investigate the technologies offered web programming, and scientific programming 1 are the most popular by Python, which are not properly revealed by the topic areas in the Python community.
    [Show full text]
  • Core Python ❱ Python Operators By: Naomi Ceder and Mike Driscoll ❱ Instantiating Classes
    Brought to you by: #193 CONTENTS INCLUDE: ❱ Python 2.x vs. 3.x ❱ Branching, Looping, and Exceptions ❱ The Zen of Python ❱ Popular Python Libraries Core Python ❱ Python Operators By: Naomi Ceder and Mike Driscoll ❱ Instantiating Classes... and More! Visit refcardz.com Python is an interpreted dynamically typed Language. Python uses Comments and docstrings indentation to create readable, even beautiful, code. Python comes with To mark a comment from the current location to the end of the line, use a so many libraries that you can handle many jobs with no further libraries. pound sign, ‘#’. Python fits in your head and tries not to surprise you, which means you can write useful code almost immediately. # this is a comment on a line by itself x = 3 # this is a partial line comment after some code Python was created in 1990 by Guido van Rossum. While the snake is used as totem for the language and community, the name actually derives from Monty Python and references to Monty Python skits are common For longer comments and more complete documentation, especially at the in code examples and library names. There are several other popular beginning of a module or of a function or class, use a triple quoted string. implementations of Python, including PyPy (JIT compiler), Jython (JVM You can use 3 single or 3 double quotes. Triple quoted strings can cover multiple lines and any unassigned string in a Python program is ignored. Get More Refcardz! integration) and IronPython (.NET CLR integration). Such strings are often used for documentation of modules, functions, classes and methods.
    [Show full text]
  • Master Thesis
    MASTER THESIS TITLE: Analysis and evaluation of high performance web servers MASTER DEGREE: Master in Science in Telecommunication Engineering & Management AUTHOR: Albert Hidalgo Barea DIRECTOR: Rubén González Blanco SUPERVISOR: Roc Meseguer Pallarès DATE: July 13 th 2011 Title: Analysis and evaluation of high performance web servers Author: Albert Hidalgo Barea Director: Rubén González Blanco Supervisor: Roc Meseguer Pallarès Date: July 13 th 2011 Overview Web servers are a very important tool when providing users with requested content on the Internet. Usage of the Internet is growing day-by-day, making those software applications essential. In the first part of the thesis, the web server world will be introduced to the reader, by giving a brief explanation of some of the available technologies as well as different dynamic protocols. Also, as there are different web servers available in the market, during this report it will be chosen the best performing ones. So, it will be presented a comparative chart between all of them in order to show the most important features of each one. Defining the scenario and the test cases is mandatory. For this reason, it is described the used hardware and software used to perform those benchmarks. The hardware is maintained equal during the whole test process, in order to let web server’s performance gaps to their internal architecture. Operating system and benchmarking tools are also described and given some examples. Furthermore, test cases are chosen to show some strengths and weakness of each web server, enabling us to compare the relative performance between them. Finally, the last part of the report consists on presenting the obtained results during the benchmark process, as well as presenting some lessons learned during the curse of the whole thesis, summing-up with some conclusions.
    [Show full text]
  • Deploying Python Applications with Httpd
    Introduction Generalities Brass Tacks Configuration/deployment example For Further Study Deploying Python Applications with httpd Jeff Trawick http://emptyhammock.com/ [email protected] April 14, 2015 ApacheCon US 2015 Introduction Generalities Brass Tacks Configuration/deployment example For Further Study Get these slides... http://emptyhammock.com/projects/info/slides.html Introduction Generalities Brass Tacks Configuration/deployment example For Further Study Revisions Get a fresh copy of the slide deck before using any recipes. If I find errors before this deck is marked as superseded on the web page, I'll update the .pdf and note important changes here. (And please e-mail me with any problems you see.) Introduction Generalities Brass Tacks Configuration/deployment example For Further Study Who am I? • My day jobs over the last 25 years have included work on several products which were primarily based on or otherwise included Apache HTTP Server as well as lower-level networking products and web applications. My primary gig now is with a Durham, North Carolina company which specializes in Django application development. • I've been an httpd committer since 2000. A general functional area of Apache HTTP Server that I have helped maintain over the years (along with many others) is the interface with applications running in different processes, communicating with the server using CGI, FastCGI, or SCGI protocols. Introduction Generalities Brass Tacks Configuration/deployment example For Further Study mod wsgi vs. mod proxy-based solution I won't cover mod wsgi in this talk. I currently use it for a couple of applications but am migrating away from it, primarily for these reasons: • mod proxy supports more separation between web server and application • Supports moving applications around or running applications in different modes for debugging without changing web server • Supports drastic changes to the web front-end without affecting application • No collision between software stack in web server vs.
    [Show full text]
  • Cherrypy Documentation Release 3.2.4
    CherryPy Documentation Release 3.2.4 CherryPy Team Jun 30, 2017 Contents 1 Foreword 1 1.1 Why CherryPy?.............................................1 1.2 Success Stories..............................................2 2 Installation 5 2.1 Requirements...............................................5 2.2 Supported python version........................................6 2.3 Installing.................................................6 2.4 Run it...................................................6 3 Tutorials 9 3.1 Tutorial 1: A basic web application................................... 10 3.2 Tutorial 2: Different URLs lead to different functions.......................... 10 3.3 Tutorial 3: My URLs have parameters.................................. 11 3.4 Tutorial 4: Submit this form....................................... 12 3.5 Tutorial 5: Track my end-user’s activity................................. 13 3.6 Tutorial 6: What about my javascripts, CSS and images?........................ 14 3.7 Tutorial 7: Give us a REST....................................... 15 3.8 Tutorial 8: Make it smoother with Ajax................................. 17 3.9 Tutorial 9: Data is all my life...................................... 19 3.10 Tutorial 10: Organize my code...................................... 22 4 Basics 23 4.1 The one-minute application example.................................. 24 4.2 Hosting one or more applications.................................... 25 4.3 Logging.................................................. 26 4.4 Configuring...............................................
    [Show full text]