CherryPy Essentials: Rapid Python Web Application by Sylvain Hellegouarch

By Sylvain Hellegouarch

This ebook covers the CherryPy library for Python net improvement from its historical past and set up via its major beneficial properties and middle ideas to its integration with Python and different items to build, attempt, and installation a pattern photoblog program. the writer Sylvain Hellegouarch is devoted to the improvement of unfastened software program initiatives and has been coordinating and administrating the group efforts round the CherryPy undertaking seeing that 2004. The method in keeping with an instance software introduces many different universal Python libraries, offering transferable talents additionally suitable for non-web Python tasks. CherryPy is a Python library for net improvement that enables builders to construct net purposes within the similar manner as the other object-oriented Python software. Enriched by means of numerous years of energetic improvement, it has turn into essentially the most validated toolkits for construction stable and high-performance net functions in Python. CherryPy abstracts the complicated low-level HTTP protocol into an easy-to-use interface that respects Python idioms. The library goals at being basic to benefit for a newbie whereas delivering the main complex positive factors to fluent Python builders. For those purposes CherryPy was once selected to be on the middle of the preferred and feature-rich TurboGears internet framework. CherryPy-powered internet purposes are stand-alone Python purposes with their very own embedded multi-threaded net server, yet may also run at the back of Apache or IIS for scalability..CherryPy set up utilizing tarball, egg, and subversion. The CherryPy library intensive: its layout and the way to take advantage of it. utilizing CherryPy with universal Python and non-Python items . item RelationalMapping with SQLObject, SQLAlchemy, and Dejavu. internet prone through leisure and the Atom Publishing Protocol. AJAX and client-side scripting through MochiKit. Unit, sensible, and cargo trying out. CherryPy, Apache, and lighttpd deployment solurionsThe ebook starts off with chapters devoted to CherryPy itself, its background and deploy. Then it strikes via a gradual creation to the most good points and ideas of CherryPy to a radical evaluate of its center services. After laying this starting place the e-book dives right into a real-world instance, detailing very important steps within the construction of a photoblog software. those chapters disguise database manipulation through item Relational Mapping (ORM), utilizing net prone to augment the appliance, and client-side scripting via AJAX. eventually, the publication covers the necessity for unit, practical, and function checking out sooner than remaining with deployment strategies for a CherryPy-based application.Who this ebook is written for This publication is especially geared in the direction of Python net builders, who're seeking to upload the facility of the CherryPy library to their current Python skillset. It assumes a very good operating wisdom of Python . even though the CherryPy toolkit is on the middle of the publication, many different universal libraries are brought.

Show description

Read or Download CherryPy Essentials: Rapid Python Web Application Development: Design, develop, test, and deploy your Python web applications easily PDF

Similar python books

Essential SQLAlchemy

Essential SQLAlchemy introduces a high-level open-source code library that makes it more uncomplicated for Python programmers to entry relational databases corresponding to Oracle, DB2, MySQL, PostgreSQL, and SQLite. SQLAlchemy has develop into more and more well known considering the fact that its unencumber, however it nonetheless lacks stable offline documentation. This useful booklet fills the distance, and since a developer wrote it, you get an aim examine SQLAlchemy's instruments instead of an advocate's description of the entire "cool" features.

SQLAlchemy comprises either a database server-independent SQL expression language and an object-relational mapper (ORM) that permits you to map "plain previous Python objects" (POPOs) to database tables with out considerably altering your latest Python code. crucial SQLAlchemy demonstrates find out how to use the library to create an easy database program, walks you thru easy queries, and explains the best way to use SQLAlchemy to hook up with a number of databases concurrently with a similar Metadata. you furthermore may learn the way to:

* Create customized forms for use on your schema, and while it's invaluable to exploit customized instead of integrated forms
* Run queries, updates, and deletes with SQLAlchemy's SQL expression language
* construct an item mapper with SQLAlchemy, and comprehend the variations among this and lively checklist styles utilized in different ORMs
* Create gadgets, store them to a consultation, and flush them to the database
* Use SQLAlchemy to version item orientated inheritance
* supply a declarative, energetic list development to be used with SQLAlchemy utilizing the Elixir extension
* Use the SQLSoup extension to supply an automated metadata and item version in keeping with database mirrored image

In addition, you'll learn the way and whilst to exploit different extensions to SQLAlchemy, together with AssociationProxy, OrderingList, and more.

Essential SQLAlchemy is the much-needed consultant for each Python developer utilizing this code library. rather than a feature-by-feature documentation, this booklet takes an "essentials" technique that offers you precisely what you want to develop into effective with SQLAlchemy correct away.

Mastering Regular Expressions (3rd Edition)

Regular expressions are an incredibly strong device for manipulating textual content and information. they're now normal positive aspects in a variety of languages and well known instruments, together with Perl, Python, Ruby, Java, VB. internet and C# (and any language utilizing the . internet Framework), Hypertext Preprocessor, and MySQL.

when you don't use normal expressions but, you can find during this publication a complete new global of mastery over your facts. if you happen to already use them, you'll get pleasure from this book's unheard of element and breadth of assurance. if you happen to imagine you recognize all you must learn about normal expressions, this ebook is a gorgeous eye-opener.

As this ebook indicates, a command of normal expressions is a useful ability. usual expressions let you code complicated and sophisticated textual content processing that you simply by no means imagined may be automatic. common expressions can prevent time and aggravation. they are often used to craft stylish options to quite a lot of difficulties. as soon as you've mastered usual expressions, they'll develop into a useful a part of your toolkit. you'll ask yourself the way you ever received by way of with out them.

but regardless of their vast availability, flexibility, and unheard of energy, ordinary expressions are often underutilized. but what's energy within the arms of knowledgeable should be fraught with peril for the unwary. getting to know average Expressions might help you navigate the minefield to turning into knowledgeable and assist you optimize your use of normal expressions.

getting to know commonplace Expressions, 3rd version, now encompasses a complete bankruptcy dedicated to personal home page and its strong and expressive suite of normal expression features, as well as improved personal home page insurance within the principal "core" chapters. moreover, this variation has been up-to-date all through to mirror advances in different languages, together with extended in-depth insurance of Sun's java. util. regex package deal, which has emerged because the common Java regex implementation. subject matters include:
* A comparability of gains between various models of many languages and instruments
* How the usual expression engine works
* Optimization (major reductions to be had the following! )
* Matching simply what you will want, yet now not what you don't wish
* Sections and chapters on person languages

Written within the lucid, wonderful tone that makes a fancy, dry subject develop into crystal-clear to programmers, and sprinkled with suggestions to advanced real-world difficulties, studying usual Expressions, 3rd variation bargains a wealth info so you might positioned to quick use.

Reviews of this new version and the second one edition:

"There isn't a greater (or extra helpful) booklet on hand on ordinary expressions. "

--Zak Greant, handling Director, eZ Systems

"A genuine tour-de-force of a e-book which not just covers the mechanics of regexes in notable aspect but additionally talks approximately potency and using regexes in Perl, Java, and . web. .. for those who use normal expressions as a part of your specialist paintings (even when you have already got a superb publication on no matter what language you're programming in) i'd strongly suggest this publication to you. "

--Dr. Chris Brown, Linux Format

"The writer does a great activity best the reader from regex amateur to grasp. The ebook is very effortless to learn and chock packed with helpful and correct examples. .. standard expressions are precious instruments that each developer must have of their toolbox. getting to know commonplace Expressions is the definitive consultant to the topic, and a great source that belongs on each programmer's bookshelf. Ten out of Ten Horseshoes. "

--Jason Menard, Java Ranch

Python Developer's Handbook

The Python Developer's instruction manual is designed to show skilled builders to Python and its makes use of. starting with a quick creation to the language and its syntax, the booklet strikes quick into extra complex programming subject matters, together with embedding Python, community programming, GUI toolkits, JPython, internet improvement, Python/C API, and extra.

Python 201: Intermediate Python

Python 201 is the sequel to my first publication, Python a hundred and one. if you happen to already recognize the fundamentals of Python and now you must visit the following point, then this is often the ebook for you! This e-book is for intermediate point Python programmers simply. There will not be any newbie chapters right here. This booklet relies onPython three.

Additional info for CherryPy Essentials: Rapid Python Web Application Development: Design, develop, test, and deploy your Python web applications easily

Sample text

To configure the CherryPy server instance itself you will need to use the global section of the settings. ). We define the host and the port on which the server will listen for incoming connections. css file is to be handled by the staticfile tool and also indicate the absolute path of the physical file to be served. We will explain in detail what tools are in the following chapters but for now imagine them as a way to extend CherryPy's internal features and enhance its possibilities. mount(application_instance, script_name, config='/path/to/config/file') Although in most cases choosing between a dictionary and a file will be a matter of taste, it may happen in some cases that one is better than the other.

In spite of that, a user can navigate an e-commerce website with the impression that the application more or less follows the way he or she would call the store to pass an order. The session mechanism was therefore brought to the Web to allow servers to keep track of users' information. CherryPy's session module offers a straightforward interface to the application developer to store, retrieve, amend, and delete chunks of data from a session object. CherryPy comes natively with three different back-end storages for session objects: Back-end type Advantages Drawbacks RAM Efficient Information lost when server is shutdown Accepts any type of objects File system Relational database (PostgreSQL built-in support) No configuration needed Memory consumption can grow fast Persistence of the information File system locking can be inefficient Simple setup Only serializable (via the pickle module) objects can be stored Persistence of the information Only serializable objects can be stored Robust Setup less straightforward Scalable Can be load balanced The advantage is that your application will use a high-level interface independent of the underlying back end.

Therefore consider the configuration settings to be relative to the application but independent of the prefix used to mount the application. The prefix where the application is mounted is referred to the script_name. Object Publisher Engine HTTP servers such as Apache or lighttpd map Request-URIs to paths on the file system making them very efficient at handling websites mainly made of static content such as images. CherryPy has chosen a completely different approach and uses its own internal lookup algorithm to retrieve the handler referred to by the Request-URI.

Download PDF sample

Rated 4.14 of 5 – based on 13 votes