Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Web Development with Sanic

You're reading from   Python Web Development with Sanic An in-depth guide for Python web developers to improve the speed and scalability of web applications

Arrow left icon
Product type Paperback
Published in Mar 2022
Publisher Packt
ISBN-13 9781801814416
Length 504 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Stephen Sadowski Stephen Sadowski
Author Profile Icon Stephen Sadowski
Stephen Sadowski
Adam Hopkins Adam Hopkins
Author Profile Icon Adam Hopkins
Adam Hopkins
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Part 1:Getting Started with Sanic
2. Chapter 1: Introduction to Sanic and Async Frameworks FREE CHAPTER 3. Chapter 2: Organizing a Project 4. Part 2:Hands-On Sanic
5. Chapter 3: Routing and Intaking HTTP Requests 6. Chapter 4: Ingesting HTTP Data 7. Chapter 5: Building Response Handlers 8. Chapter 6: Operating Outside the Response Handler 9. Chapter 7: Dealing with Security Concerns 10. Chapter 8: Running a Sanic Server 11. Part 3:Putting It All together
12. Chapter 9: Best Practices to Improve Your Web Applications 13. Chapter 10: Implementing Common Use Cases with Sanic 14. Chapter 11: A Complete Real-World Example 15. Other Books You May Enjoy

What this book covers

Chapter 1, Introduction to Sanic and Async Frameworks, covers the background information on why Sanic was built, how it is developed, where it is headed, and who should use it. Important takeaways include the difference between WSGI, Async, and ASGI servers; what is a framework versus a server; and what developers should do to set up their project for success.

Chapter 2, Organizing a Project, takes you through the common approaches to organizing a project, and ideas to help decide an appropriate solution that fits the needs of what you are building.

Chapter 3, Routing and Intaking HTTP Requests, focuses upon the first interactions that the server has with an incoming web request. You'll learn about: how requests are structured; what choices Sanic makes for us and what choices it leaves to us; and other issues involved in turning an HTTP request into actionable code.

Chapter 4, Ingesting HTTP Data, focuses on the types of data that can be received and some effective tools for handling them. You will learn how to extract (and use) data from headers, cookies, paths, body, and query arguments; and also some useful tools to make it easier to build good applications with the data.

Chapter 5, Building Response Handlers, explores different techniques for sending content back to the clients. Modern applications often need several techniques to provide high-quality experiences and dynamic content. You will learn about when to apply each technique and how to optimize Sanic for each use case.

Chapter 6, Operating Outside the Response Handler, goes through all of the other stuff that Sanic can do besides just simple response handlers. You will learn about how to use listeners, middleware, signals, and background tasks to customize web applications. The goal is to learn to recognize patterns that can be applied in a variety of use cases.

Chapter 7, Dealing with Security Concerns, focuses upon common security concerns and how to deal with them in Sanic. Since this topic alone is quite extensive, the approach will be to introduce the concern and explain the issue as it relates to Sanic. Then we will look at common mitigation strategies and what they would look like in Sanic.

Chapter 8, Running a Sanic Server, focuses upon setting up a server for both local development and production-ready environments. Again, this topic can be extremely lengthy by itself. Therefore, the goal is not to be a tutorial on how to use tools such as Docker and Kubernetes. After the introduction, this chapter assumes some working knowledge, provides other materials for reference, and focuses on what these tools mean for Sanic. You will learn about some common deployment patterns and when/how you should decide to use them.

Chapter 9, Best Practices to Improve Your Web Applications, covers some practical tips on how to make your web applications better. The areas covered are the sorts of finishing touches that make an application feel "professional," and most importantly easier to maintain for future iterations.

Chapter 10, Implementing Common Use Cases with Sanic, analyzes common to slightly advanced use cases in depth and how to implement them in Sanic. We will start each section with a description of the problems encountered. After providing solutions, we will do a review of the implementations and try to draw some conclusions and generalizations that can be taken by you to other applications.

Chapter 11, A Complete Real-World Example, provides you with a complete web application that you can learn from. The source code is available for you to review, and the application itself is hosted online so that you can interact with it while trying to learn from it. You are encouraged to check it out at https://sanicbook.com.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime