Manning Early Access Program (MEAP)Chapters 1 to 9When you’re new to Python, it can be tough to understand where and how to use its many language features. There’s a dizzying array of libraries, and it’s challenging to fit everything together. The Well-Grounded Python Developer builds on Python skills you’ve learned in isolation and shows you how to unify them into a meaningful whole. As you work through this practical guide, you’ll discover how all the bits of the Python ecosystem connect as you build and modify a typical web server application. The Well-Grounded Python Developer MEAP V05 Copyright Welcome Brief contents Chapter 1: Becoming a Pythonista 1.1 Who is the intended audience? 1.2 Being a developer 1.2.1 Solving Problems 1.2.2 Process 1.2.3 Your Customers 1.2.4 Commitment to Learning 1.3 Reaching goals 1.3.1 Thinking like a developer 1.3.2 Building Applications 1.4 Using Python 1.4.1 The Syntax 1.4.2 Variables 1.4.3 Programming Paradigms 1.4.4 Creating Maintainable Code 1.4.5 The Language Community 1.4.6 The Developer Tooling 1.4.7 Performance 1.5 Version of Python to use 1.6 Summary Chapter 2: Your Python Environment 2.1 Installing Python 2.1.1 Windows 2.1.2 Mac 2.1.3 Linux 2.2 Python Virtual Environment 2.2.1 Windows 2.2.2 Mac and Linux 2.3 Setting up Visual Studio Code 2.3.1 Installing Visual Studio Code 2.3.2 Installing Python Extension 2.3.3 Other Useful Extensions 2.3.4 Starting From the Command Line 2.3.5 Starting a Project 2.4 Some Advice 2.5 Summary Chapter 3: Names and Namespaces 3.1 Names 3.1.1 Naming Things 3.1.2 Naming Experiment 3.2 Namespaces 3.3 Python Namespaces 3.3.1 BuiltIns Level 3.3.2 Module Level 3.3.3 Function Level 3.3.4 Namespace Scope 3.3.5 Namespace Experiment 3.4 Summary Chapter 4: Application Programming Interface 4.1 Application Programmers Interface 4.1.1 A Contract Between Pieces Of Code 4.1.2 What's Passed As Input 4.1.3 What's Expected As Output 4.2 Function API 4.2.1 Naming 4.2.2 Arguments 4.2.3 Return Value 4.2.4 Single Responsibility 4.2.5 Function Length 4.2.6 Idempotent 4.2.7 Side Effects 4.3 Documentation 4.4 Summary Chapter 5: Object-Oriented Coding 5.1 Object-oriented 5.1.1 Class Definition 5.1.2 Drawing With Class 5.1.3 Inheritance 5.1.4 Polymorphism 5.1.5 Composition 5.2 Summary Chapter 6: Exception Handling 6.1 Exceptions 6.2 Handling Exceptions 6.2.1 Handle An Exception If The Code Can Do Something About It 6.2.2 Allow Exceptions To Flow Upward In Your Programs 6.2.3 Never Silence An Exception 6.3 Raising An Exception 6.4 Creating Your Own Exceptions 6.5 Summary Chapter 7: Your First Web Server 7.1 The Project Application 7.1.1 Web Application Advantages 7.1.2 Web Application Challenges 7.2 Servers 7.2.1 Request / Response Model 7.3 Web Servers 7.4 Flask 7.4.1 Why Flask 7.4.2 Your First Web Server 7.4.3 Serving Content 7.4.4 More Jinja2 Features 7.5 Running the Web Server 7.5.1 Gunicorn 7.5.2 Commercial Hosting 7.6 Summary Chapter 8: Getting started with MyBlog 8.1 Handling Application Styling 8.1.1 Creating Appealing Styles 8.1.2 Styling Consistency 8.1.3 Normalizing Styles 8.1.4 Responsive Design 8.2 Integrating Bootstrap 8.2.1 Bootstrap Version 8.2.2 Previous Example Now With Bootstrap! 8.3 Helping MyBlog Grow 8.3.1 The Flask app Instance 8.4 MyBlog Namespaces 8.4.1 Flask Blueprints 8.4.2 Add Blueprints To MyBlog 8.4.3 Create the About Page 8.4.4 Refactored App Instance 8.5 MyBlog Navigation 8.5.1 Creating Navigation Information 8.5.2 Displaying the Navigation Information 8.5.3 MyBlog's Current Look 8.6 Application Configuration 8.6.1 Configuration Files 8.6.2 Private Information 8.7 Flask Debug Toolbar 8.7.1 FlaskDynaConf 8.8 Logging Information 8.8.1 Configuration 8.9 Adding a favicon 8.10 Summary Chapter 9: Authenticating the user 9.1 The HTTP Protocol is Stateless 9.1.1 Sessions 9.2 Remembering the User 9.2.1 Authenticating Users 9.2.2 User Login 9.3 Flask Flash Messages 9.3.1 Improving the Login Form 9.4 Registering New Users 9.4.1 New User Form 9.4.2 Oh Yeah, Logging Out 9.4.3 Navigation 9.5 Confirming New Users 9.5.1 Sending Email 9.6 Resetting User Passwords 9.7 User Profile 9.8 Security 9.8.1 Protecting Routes 9.8.2 Authorizing Routes 9.8.3 Protecting Forms 9.9 Summary If you're new to Python, it can be tough to understand when, where, and how to use all its language features. This friendly guide shows you how the Python ecosystem fits together, and grounds you in the skills you need to continue your journey to being a software developer.Summary Inside The Well-Grounded Python Developer you will discover: Building modules of functionality Creating a well-constructed web server application Integrating database access into your Python applications Refactor and decoupling systems to help scale them How to think about the big picture of your application The Well-Grounded Python Developer builds on Python skills you've learned in isolation and shows you how to unify them into a meaningful whole. It helps you understand the dizzying array of libraries and teaches important concepts, like modular construction, APIs, and the design of a basic web server. As you work through this practical guide, you'll discover how all the bits of Python link up as you build and modify a typical web server application—the kind of web app that's in high demand by modern businesses. About the technology As a new programmer, you're happy just to see your code run. A professional developer, on the other hand, needs to create software that runs reliably. It must be fast, maintainable, scalable, secure, well designed and documented, easy for others to update, and quick to ship. This book teaches you the skills you need to go from Python programmer to Python developer. About the book The Well-Grounded Python Developer shows you why Python, the world's most popular programming language, is a fantastic tool for professional development. It guides you through the most important skills, like how to name variables, functions, and classes, how to identify and write a good API, and how to use objects. You'll also learn how to deal with inevitable failures, how to make software that connects to the internet, core security practices, and many other professional-grade techniques. What's inside Create a web application Connect to a database Design programs to handle big tasks About the reader For experienced beginners who want to learn professional-level skills. About the author Doug Farrell has been a professional developer since 1983, and has worked with Python for over 20 years. Table of Contents 1 Becoming a Pythonista PART 1 - GROUNDWORK 2 That's a good name 3 The API: Let's talk 4 The object of conversation 5 Exceptional events PART 2 - FIELDWORK 6 Sharing with the internet 7 Doing it with style 8 Do I know you? Authentication 9 What can you do? Authorization 10 Persistence is good: Databases 11 I've got something to say 12 Are we there yet?