From Java to Python

You want to get up and running with the Django web framework, but don't know where to start? Maybe some of the differences between Django's and Java's environments have gotten you down? Then Django for Java Developers is absolutely the book for you!

Drawing parallels

Focused on developers who have come to grips with building Java web applications, the book guides you through the setup of Django, explaining how each part of Python's famous web framework maps to stuff you already know.

Learn by making mistakes

You'll never give up on a project that's working perfectly, so we'll show you exactly what will cause errors, how Django tries to tell you about those errors and how you can resolve them. We don't want to give you a fish — we want to teach you how to fish.

Build and deploy a complete project

Django for Java Developers will guide you through the development of an issue tracker, covering all the bases from database setup, entities/models and forms to testing and security.

Discontinued!

The book won't land. Please refer to the excellent official Django documentation.

Table of contents

Setting up

Find out how you can start set up a development environment and start working with dependencies just like you would with Maven. Only better and less XML-y.

Creating a Django project

We'll walk you through creating a Django project from scratch, including some tools to make this easier.

Request-response cycle

You know you're servlets and filters like the back of your hand. This chapter will introduce the equivalents in Django —views, middleware and context processors— and detail how a request is turned into response.

Bugger specs

Writing an application without a specification is crazy. Here you'll find out exactly what you'll be building in the next chapters.

Writing models

Time to turn our specs into reality by writing Django models. Find out how you can let Django create the database tables for you and, as an extra, see how to employ South to handle database migrations.

Enabling the admin

Django's Admin is the module that's probably largely responsible for the popularity of Django. Find out how to enable this powerful tool and use it to your advantage.

Writing views and forms

You'll create forms with four lines of code, write HTML templates to render them to the user and then take in the submitted form with another six lines of code.

Security

Security should always be on the back of your mind when writing (web) applications and it's no different in Django.

Testing

Writing tests is a lot better than being waken up at 3 in the morning because your application keeps crashing. Harness Django's testing framework to make sure you can sleep tight.

Completing Bugger

This chapter makes sure all the parts laid out in our specifications are present in our final application.

Logging

How will you find out what exactly went wrong when a user hit the blue instead of the red button? Logging!

Deploying

A step-by-step guide on how to deploy a Django web application on Heroku and on your own Ubuntu server.

Q&A

Do I need to know anything about Django?
No. You'll find out exactly how to start using Django. That's the entire point of the book.
Do I need to know Python?
Yes! Django for Java Developers is an introduction to Django, not Python. You don't need to know the intricate details of Python, but you should know most things from Dive Into Python to follow along.
What does this offer over Django's own documentation?
Django's documentation is one of the best in the world of frameworks. Seriously. And it's only getting better! But with this book you'll find out how concepts from Python and Django web development map to Java web development, how to isolate your environment and manage dependencies —similar to using Maven or Ivy— and how to find out what's going on when something unexpected happens.

About the author

Hi, I'm Kevin Wetzels, author of Django for Java Developers. I've been developing Java applications large and small for years, but fell in love with Django about five years ago. Its ORM is a lot easier to grok than classic Hibernate or JPA, its template language far clearer than JSP files and writing views is a breath of fresh air over writing servlets or any kind of web controller in Java. Django allows me to get things done quicker; end of story.

Want to talk Django? Get in touch at kevin@roam.be or @roambe on Twitter.

Django for Java Developers is a product of Roam