Chapter . Introduction

If you’re a Web developer, a programmer who creates Web sites, then Django just might change your life. It has certainly changed ours.

Anyone with even a little experience building dynamic Web sites knows the pain of reinventing certain standard features over and over. You need to create database schemas. You need to get data into and out of the database. You need to parse URLs. You need to sanitize input. You need to provide content-editing tools. You need to attend to security and usability. And so on.

Where Web Frameworks Come From

At some point you realize the wastefulness of reimplementing all these features on every new project; you decide to code your own libraries from scratch to provide them—or, more likely, you extract those libraries from your latest and greatest creation. Thereafter, when you start a new project, the first thing you do is install your library code. It saves you work and time.

However, there are still rough spots. Clients want features that aren’t provided by your library code, so you add these. Different clients need different things, so you end up with different versions of your library installed on different servers. Maintenance becomes hell.

So then, seasoned with experience, you take your base library and all the best add-ons from your various projects and combine them. For most projects you no longer have to tweak your library code directly; you alter a configuration file instead. Your codebase is bigger and more complicated, but it’s also more powerful.

Congratulations, you’ve written a Web framework.

And as long as you (or your team, or your company, or your clients) keep on using it, you’re responsible for keeping it working. Will the next upgrade of your OS, your Web server, or your programming language break it? Will it be flexible enough to accommodate future changes without great pain? Does it support difficult but important features like session management, localization, and database transactions? And how’s your test coverage?

A Better Way

You have this book in your hands because you want something better. You want a powerful, flexible, elegant, well-tested framework you don’t have to maintain yourself.

You want to write your code in a real programming language; one that is powerful, clean, mature, and extensively documented. You want it to have a great standard library and a huge selection of high-quality third-party packages for whatever needs arise, from generating a CSV or a pie chart to scientific computations or image file processing.

You want a framework that has a vibrant, helpful community of users and developers; one that is designed to function smoothly as an integrated stack, but whose components are loosely coupled, so you can make substitutions if circumstances require.

In short, you want Python, and you want Django. We wrote this book to help you learn and use Django in real-world settings as easily, quickly, and smartly as possible.

We’re Not in Kansas Anymore

Django was originally written by Adrian Holovaty and Simon Willison at World Online, the Web arm of a family-owned media company in Lawrence, Kansas. It was born out of a need to quickly develop database-driven applications tied into news content.

After proving itself in the field, Django was released as an open source project in July 2005—a time, ironically, when it was widely felt that Python had far too many Web frameworks—and rapidly gained a strong following. Today, it is one of the leaders not just among Python frameworks, but among Web frameworks in general.

Django is still heavily used at World Online of course, and some of its core developers work there and use it daily. But since Django’s open source release, companies and organizations around the world have picked it up for use in projects large and small. A partial list includes

  • The Washington Post

  • The Lawrence Journal-World

  • Google

  • EveryBlock

  • Newsvine

  • Curse Gaming

  • Tabblo

  • Pownce

There are, of course, thousands of other Django sites that are not (yet) household names. It’s inevitable that as Django spreads and grows that an increasing number of popular sites will be powered by it. We hope that yours is one of them.

Web Development Is Better with Python and Django

Web development is generally messy business. You have to contend with browser incompatibilities, rogue bots, bandwidth and server limitations, and an overall architecture that seems to defy thorough testing.

Of course, we believe our book is an excellent introduction to the basics of Django, but we also aim to address many of those messy spots—the 20 percent of your work that can take 80 percent of your time. We’ve worked with, listened to, and helped many developers using Django and have kept their questions and challenges in mind while writing this book.

If we didn’t think that Django and Python were great, we wouldn’t have gone to the trouble of writing a whole book about them. But when there are limitations you should know about or sharp edges you should watch out for, we’ll tell you. Our goal is to help you get things done.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.110.176