Beginning Django E-Commerce

Book description

Beginning Django E-Commerce guides you through producing an e-commerce site using Django, the most popular Python web development framework.

Table of contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Introduction
    1. Who This Book Is For
    2. The Web Sites In This Book
    3. Source Code and Errata
  6. 1. Best Laid Plans
    1. 1.1. Selling Stuff Online
    2. 1.2. Why Django?
      1. 1.2.1. Straying From the Django Philosophy
      2. 1.2.2. A Quick Word on the Software
      3. 1.2.3. A Note on Version Control
      4. 1.2.4. Firefox
    3. 1.3. Installing the Software
      1. 1.3.1. Installing Python
      2. 1.3.2. Installing Django
      3. 1.3.3. Installing MySQL
      4. 1.3.4. Installing Eclipse and the PyDev Extensions
    4. 1.4. Things to Consider Before You Start
      1. 1.4.1. Security
      2. 1.4.2. Accessibility
      3. 1.4.3. PCI Compliance
      4. 1.4.4. Search Engine Optimization
      5. 1.4.5. Deployment
    5. 1.5. Business Requirements
      1. 1.5.1. Accounting & Auditing
      2. 1.5.2. Supply Chain Management
      3. 1.5.3. Marketing Decisions
    6. 1.6. Summary
  7. 2. Creating a Django Site
    1. 2.1. A Django-istic Welcome
      1. 2.1.1. Creating the Project
      2. 2.1.2. What Django Creates
    2. 2.2. Creating the MySQL Database
    3. 2.3. Dealing with Django Exceptions
    4. 2.4. Template & View Basics
    5. 2.5. Advanced Templates with Inheritance
    6. 2.6. Greater Ease with render_to_response()
    7. 2.7. Adding in the CSS
    8. 2.8. Location, Location, Location
    9. 2.9. A Site Navigation Include
    10. 2.10. A Word (or Two) About URLs
    11. 2.11. Summary
  8. 3. Models for Sale
    1. 3.1. Databases 101
      1. 3.1.1. An Introduction To SQL
      2. 3.1.2. What Makes a Relational Database
    2. 3.2. What Django Gives You – The ORM
    3. 3.3. Creating the Catalog App
    4. 3.4. Creating the Django Models
      1. 3.4.1. Model Field Data Types
      2. 3.4.2. Creating the Category Model
      3. 3.4.3. Creating the Product Model
    5. 3.5. The Django Admin Interface
      1. 3.5.1. Product and Category Admins
      2. 3.5.2. A Note on Model Validation
      3. 3.5.3. Syncing Up the Models
      4. 3.5.4. Playing with Model Structure and Data
    6. 3.6. Templates, URLs, and Views
      1. 3.6.1. Configuring Page Titles and Meta Tags
      2. 3.6.2. Coding Up the Catalog Views
      3. 3.6.3. Creating the Template Files
      4. 3.6.4. A Category Link List
    7. 3.7. Our Code in Review
      1. 3.7.1. So How Does It All Work?
      2. 3.7.2. File Not Found and Custom 404s
    8. 3.8. Summary
  9. 4. The Shopping Cart
    1. 4.1. Shopping Cart Requirements
    2. 4.2. An Introduction to Sessions
      1. 4.2.1. The Shopping Cart Model
      2. 4.2.2. Django Sessions Overview
      3. 4.2.3. Enabling and Using Sessions
    3. 4.3. Using Django Forms
      1. 4.3.1. The Add To Cart Form
      2. 4.3.2. Processing the Form
      3. 4.3.3. Putting It All Together
      4. 4.3.4. Cart Form Code in Review
    4. 4.4. Creating the Shopping Cart Page
      1. 4.4.1. Django Template 'if' and 'for' Tags
      2. 4.4.2. Custom Template Filters
      3. 4.4.3. Creating the Cart Page
    5. 4.5. Adding Custom Template Tags
      1. 4.5.1. Re-creating the Category List Tag
      2. 4.5.2. Static Content with Flatpages
      3. 4.5.3. Navigation Tags
    6. 4.6. Summary
  10. 5. Site Checkout & Orders
    1. 5.1. Google Checkout API
      1. 5.1.1. Signing up with Google Checkout
      2. 5.1.2. Submitting Orders to Google
      3. 5.1.3. Building XML Documents in Python
      4. 5.1.4. Making HTTP Requests in Python
      5. 5.1.5. Your Google Merchant ID and Key
      6. 5.1.6. The Python Property Decorator
      7. 5.1.7. Creating the Checkout App
    2. 5.2. Order Checkout Requirements
      1. 5.2.1. SSL Middleware
      2. 5.2.2. DRY Models and Forms
      3. 5.2.3. Secure HTTP Requests
      4. 5.2.4. Credit Card Transactions
    3. 5.3. Order Checkout by Django
      1. 5.3.1. Signing up for an Authorize.Net Test Account
      2. 5.3.2. Order Information Models
      3. 5.3.3. The Checkout Form
      4. 5.3.4. Authorization and Capture
      5. 5.3.5. Order Processing
      6. 5.3.6. Checkout Views and URLs
      7. 5.3.7. Checkout Template and Order Form
      8. 5.3.8. Order Administration
    4. 5.4. Summary
  11. 6. Creating User Accounts
    1. 6.1. Making Friends with the Source
    2. 6.2. Hooking Into Django's Authentication
      1. 6.2.1. Creating the Login & Registration Pages
      2. 6.2.2. The My Account Page
      3. 6.2.3. The Change Password Page
      4. 6.2.4. The Order Details Page
    3. 6.3. Django User Profiles
      1. 6.3.1. Abstract Base Classes
      2. 6.3.2. The Order Info Page
      3. 6.3.3. Updating the Checkout Page
    4. 6.4. Summary
  12. 7. Product Images
    1. 7.1. Dealing with Images
      1. 7.1.1. Django Image Fields
      2. 7.1.2. Installing the Python Imaging Library
      3. 7.1.3. Database Changes
      4. 7.1.4. Editing the Model
      5. 7.1.5. Adding a New Image
    2. 7.2. Image Template Changes
    3. 7.3. Summary
  13. 8. Implementing Product Search
    1. 8.1. Instant Search
      1. 8.1.1. Search Requirements
      2. 8.1.2. Model Managers
      3. 8.1.3. Complex Lookups with Q
      4. 8.1.4. Search Results Pagination
      5. 8.1.5. Implementing Search
      6. 8.1.6. The Search Module
      7. 8.1.7. Search Template Tags
      8. 8.1.8. Search View and Template
    2. 8.2. Third-Party Search Solutions
    3. 8.3. Summary
  14. 9. Intelligent Cross-Selling
    1. 9.1. Product Page Recommendations
      1. 9.1.1. Order-Based Filtering
      2. 9.1.2. Customer-Based Order Filtering
      3. 9.1.3. A Hybrid Approach
    2. 9.2. Home Page Recommendations
      1. 9.2.1. Tracking Each User
      2. 9.2.2. Dealing with Searches
      3. 9.2.3. View-Based Recommendations
    3. 9.3. Building the Homepage
    4. 9.4. Summary
  15. 10. Adding in Ajax
    1. 10.1. The Ajax Pros and Cons
    2. 10.2. How Ajax Works
    3. 10.3. jQuery for Ajax
      1. 10.3.1. Getting jQuery
      2. 10.3.2. jQuery Basics
      3. 10.3.3. JavaScript Object Notation
      4. 10.3.4. Making Ajax Requests
    4. 10.4. Product Reviews
      1. 10.4.1. Review Model and Form
      2. 10.4.2. Template and View Changes
      3. 10.4.3. The Ajax Part of this Equation
      4. 10.4.4. Adding a Product Review
    5. 10.5. Product Catalog Tagging
      1. 10.5.1. Getting Django-Tagging
      2. 10.5.2. Django Content Types
      3. 10.5.3. Enabling Product Tagging
      4. 10.5.4. Creating the Tag Cloud
    6. 10.6. JavaScript Finishing Touches
    7. 10.7. Summary
  16. 11. Search Engine Optimization
    1. 11.1. The Importance of Inbound Links
    2. 11.2. Content Is King
      1. 11.2.1. Title and Meta Tags
      2. 11.2.2. Keywords in URLs
      3. 11.2.3. Generating a Keyword List
      4. 11.2.4. The Duplicate Content Problem
      5. 11.2.5. Semantic Web - Microformats & RDFa
    3. 11.3. Launching the Site
      1. 11.3.1. Submit Your URL
      2. 11.3.2. robots.txt File
      3. 11.3.3. Sitemaps for Search Engines
      4. 11.3.4. Content Relocation
    4. 11.4. Google Webmasters
    5. 11.5. Google Analytics
      1. 11.5.1. The Data Warehouse Principle
      2. 11.5.2. Signing Up for Google Analytics
      3. 11.5.3. E-Commerce and Search Tracking
    6. 11.6. Google Base Product Feed
    7. 11.7. 500 Server Errors
    8. 11.8. Summary
  17. 12. Web Security Overview
    1. 12.1. Securing the Site From Within
      1. 12.1.1. Django Permissions
      2. 12.1.2. Applying Permissions to Users
      3. 12.1.3. Applying Permissions to Groups
    2. 12.2. Protecting Against External Attacks
      1. 12.2.1. The Evils of Debug Mode
      2. 12.2.2. Configuring Local Settings
      3. 12.2.3. Customer Registration Revisited
      4. 12.2.4. Cross-Site Scripting Attacks
      5. 12.2.5. What's in a QueryString?
      6. 12.2.6. Cross-Site Request Forgery
      7. 12.2.7. SQL Injection
      8. 12.2.8. Moving the Admin Interface
    3. 12.3. Storing Secrets
      1. 12.3.1. Storing Customer Passwords
      2. 12.3.2. Storing Credit Card Data
      3. 12.3.3. Symmetric Cryptography
      4. 12.3.4. Google Keyczar
      5. 12.3.5. A Credit Card Model and Form
    4. 12.4. Summary
  18. 13. Improving Performance
    1. 13.1. The Database
      1. 13.1.1. Searching your Models
      2. 13.1.2. Avoiding Expensive Joins
      3. 13.1.3. Creating Database Indexes
      4. 13.1.4. Deleting Old Data
    2. 13.2. Caching with Memcached
      1. 13.2.1. The Virtue of Stale Data
      2. 13.2.2. Template Caching
      3. 13.2.3. The Low-Level Cache API
      4. 13.2.4. Django Signals for Cache Invalidation
      5. 13.2.5. A Quick Word about Django Signals
    3. 13.3. Front-End Engineering
      1. 13.3.1. Move CSS and JavaScript Into Separate Files
      2. 13.3.2. Reduce the Number of External Components
      3. 13.3.3. Optimize External Components
    4. 13.4. Summary
  19. 14. Django Testing
    1. 14.1. Why We Test
      1. 14.1.1. How to Test Code
      2. 14.1.2. Creation of the Test Database
      3. 14.1.3. Python & Django Test Methods
      4. 14.1.4. Anatomy of a Test Class
    2. 14.2. Testing the Product Catalog
      1. 14.2.1. Writing Functional Tests
      2. 14.2.2. Managing Test State with Fixtures
      3. 14.2.3. Category Testing
      4. 14.2.4. Testing the ActiveProductManager
    3. 14.3. Product Catalog Model Tests
    4. 14.4. Testing Forms & Shopping Cart
    5. 14.5. Testing the Checkout Form
    6. 14.6. Security Testing
    7. 14.7. Summary
  20. 15. Deployment
    1. 15.1. The Django Philosophy
    2. 15.2. Finding a Hosting Plan
    3. 15.3. Phase One: Apache and mod_wsgi
      1. 15.3.1. Installing the Apache Web Server
      2. 15.3.2. Creating the mod_wsgi File and Apache Virtual Host
    4. 15.4. Phase Two: Nginx for Static Media
      1. 15.4.1. Installing and Configuring NginX
    5. 15.5. Updating the Apache Virtual Host
    6. 15.6. Phase Three: Configuring SSL
    7. 15.7. Transferring Data with Django
    8. 15.8. The Admin Interface Styles
    9. 15.9. Summary
  21. 16. Django on Google App Engine
    1. 16.1. The Inconvenient Truth
    2. 16.2. Signing Up For An Account
    3. 16.3. The Django App Engine Patch
    4. 16.4. Getting the Test Page Running
    5. 16.5. Our Google App Engine Store
    6. 16.6. The Brubeck Shopping Cart App
    7. 16.7. Views and Templates
    8. 16.8. Managing Database Indexes
    9. 16.9. Error Logs, Remote Data API, and Network Programming
    10. 16.10. Summary

Product information

  • Title: Beginning Django E-Commerce
  • Author(s):
  • Release date: October 2009
  • Publisher(s): Apress
  • ISBN: 9781430225355