You are previewing Django Project Blueprints.
O'Reilly logo
Django Project Blueprints

Book Description

Develop stunning web application projects with the Django framework

About This Book

  • Build six exciting projects and use them as a blueprint for your own work

  • Extend Django's built-in models and forms to add common functionalities into your project, without reinventing the wheel

  • Gain insights into the inner workings of Django to better leverage it

  • Who This Book Is For

    If you are a Django web developer able to build basic web applications with the framework, then this book is for you. This book will help you gain a deeper understanding of the Django web framework by guiding you through the development of seven amazing web applications.

    What You Will Learn

  • Create a blogging platform and allow users to share posts on different blogs

  • Prioritise user-submitted content with an intelligent ranking algorithm based on multiple factors

  • Create REST APIs to allow non-browser based usage of your web apps

  • Customize the Django admin to quickly create a full-featured and rich content management system

  • Use Elasticsearch with Django to create blazing fast e-commerce websites

  • Translate your Django applications into multiple languages

  • Dive deep into Django forms and how they work internally

  • In Detail

    Django is a high-level web framework that eases the creation of complex, database-driven websites. It emphasizes on the reusability and pluggability of components, rapid development, and the principle of don't repeat yourself. It lets you build high-performing, elegant web applications quickly.

    There are several Django tutorials available online, which take as many shortcuts as possible, but leave you wondering how you can adapt them to your own needs. This guide takes the opposite approach by demonstrating how to work around common problems and client requests, without skipping the important details. If you have built a few Django projects and are on the lookout for a guide to get you past the basics and to solve modern development tasks, this is your book.

    Seven unique projects will take you through the development process from scratch, leaving no stone unturned. In the first two projects, you will learn everything from adding ranking and voting capabilities to your App to building a multiuser blog platform with a unique twist. The third project tackles APIs with Django and walks us through building a Nagios-inspired infrastructure monitoring system. And that is just the start!

    The other projects deal with customizing the Django admin to create a CMS for your clients, translating your web applications to multiple languages, and using the Elasticsearch search server with Django to create a high performing e-commerce web site. The seventh chapter includes a surprise usage of Django, and we dive deep into the internals of Django to create something exciting!

    When you're done, you'll have consistent patterns and techniques that you can build on for many projects to come.

    Style and approach

    This easy-to-follow guide is full of examples that will take you through building six very different web applications with Django. The code is broken down into manageable bites and then thoroughly explained.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Django Project Blueprints
      1. Table of Contents
      2. Django Project Blueprints
      3. Credits
      4. About the Author
      5. About the Reviewer
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Blueblog – a Blogging Platform
        1. The contrib packages
        2. Setting up our development environment
          1. Database settings
          2. Static files settings
          3. A base template
        3. User accounts
          1. A user accounts app
          2. Account registration
            1. Generic views
            2. Template and URLs
          3. Login and logout
            1. The login view
            2. The logout view
            3. Navigation links
          4. The blog
          5. Models
          6. Creating a blog view
          7. The home page
          8. The blog settings view
          9. Creating and editing blog posts
          10. Editing blog posts
          11. Viewing blog posts
        4. Multiple users
          1. Security
          2. Sharing blog post
        5. Summary
      9. 2. Discuss – a Hacker News Clone
        1. Chapter code packs
        2. Requirements
        3. Starting out
        4. Link submission
        5. Comments
        6. Voting
        7. Ranking submission
        8. Spam protection
        9. Summary
      10. 3. Djagios – a Nagios Clone in Django
        1. Code pack
        2. Requirements
        3. The model
        4. Fake data generation
          1. Django management commands
          2. A better model representation
        5. Status page
        6. Alerts
          1. The model
          2. Management views
        7. Showing triggered alerts on the status page
        8. Accepting data from remote systems
          1. Testing API endpoints
        9. Summary
      11. 4. A Car Rental App
        1. Code pack
        2. Fixtures
        3. Image and File fields
        4. get_absolute_url
        5. The Django admin app
        6. Showing the car names
        7. Booking management
          1. A peek behind the curtain
        8. Improving the user experience
          1. Filtering objects
          2. Searching for objects
          3. Quick edit
          4. Admin actions
          5. UX improvements
        9. Summary
      12. 5. Multilingual Movie Database
        1. Requirements
        2. Getting the project up and running
        3. Translating our static content
        4. How did all that work?
        5. Letting the user decide which language to use
        6. Persisting the user choice
        7. Translating our models
        8. Summary
      13. 6. Daintree – an E-commerce Site
        1. Code pack
        2. Exploring Elasticsearch
          1. First steps with Elasticsearch
        3. Searching from Python
        4. Mapping
          1. Defining a mapping
        5. Inserting documents into Elasticsearch from Python
          1. Getting all our data into Elasticsearch
        6. Adding search
          1. Configuration management
          2. More search options
        7. Aggregations and filters
          1. Category aggregation
          2. Full text search and analysis
        8. Searching with aggregations
        9. Summary
      14. 7. Form Mason – a Monkey of your own
        1. Code pack
        2. Looking at a Django form
          1. Adding an extra field to a SampleForm instance
        3. Generating dynamic forms
          1. Generating a form out of JSON
        4. A model for our JSON
        5. Creating a better user interface
        6. Saving the responses
        7. Showing the responses
          1. An improved responses list
        8. Designing a form creation interface
        9. Small fixes
        10. Summary
      15. A. Development Environment Setup Details and Debugging Techniques
        1. Using pdb to debug Django views
        2. Developing on Windows
      16. Index