Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Django 1.0 Website Development
Django 1.0 Website Development

Django 1.0 Website Development: Build powerful web applications, quickly and cleanly, with the Django application framework

eBook
$23.39 $25.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Django 1.0 Website Development

Chapter 2. Getting Started

Python and Django are available for multiple platforms. In this chapter, we will see how to set up our development environment on UNIX/Linux, Windows, and Mac OS X. We will also see how to create our first project and connect it to a database.

We will learn about the following topics in this chapter:

  • Installing Python

  • Installing Django

  • Installing a database system

  • Creating your first project

  • Setting up the database

  • Launching the development server

Installing the required software


Our development environment consists of Python, Django, and a database system. There are many different database systems available. In this book, we will be using a system known as SQLite. In the following section, we will see how to install the necessary software packages.

Installing Python

Django is written in Python, so the first step in setting up our development environment is to install Python. Python is available for a variety of operating systems, and installing it is not very different from installing any other software package. The procedure depends on your operating system.

You will need a recent version of Python. Django requires Python 2.3 or higher. The latest version of Python, at the time of writing, is 2.5.

We will now look at the installation process for each operating system.

Installing Python on Windows

Python has a standard installer for Windows users. You will need to go to http://www.python.org/download/ and download the latest version of...

Creating your first project


Now that the software we need is in place, here comes the fun part—creating our first Django project!

As you may recall from the Django installation section, we used a command called django-admin.py to test our installation. This utility is at the heart of Django's project management facilities, as it enables the user to do a range of project management tasks. They include the following:

  • Creating a new project

  • Creating and managing the project's database

  • Validating the current project and testing for errors

  • Starting the development web server

In the rest of this chapter, we will see how to use some of these tasks and create a basis for our bookmark-sharing application in the process.

Creating an empty project

To create your first Django project, open a terminal (or command prompt for Windows users), type the following command, and hit Enter:

$ django-admin.py startproject django_bookmarks

This command will create a folder named django_bookmarks in the current directory...

Summary


In this chapter, we prepared our development environment, created our first project, and learned how to launch the Django development server. We are now ready to start building our social bookmarking application.

Here is a quick summary of the Django features covered in this chapter:

  • Django can be downloaded from the official Django website at http://www.djangoproject.com/. Given that it is written in Python, the same package works on all major operating systems.

  • To start a new Django project, issue the following command:

    $ django-admin.py startproject <project-name>
    
  • To create database tables, issue the following command:

    $ python manage.py syncdb
    
  • To start the development server, issue the following command:

    $ python manage.py runserver
    
  • Django project settings are stored in the settings.py file. This file is a regular Python source file that can be edited using any source code editor. To change a variable, simply assign the desired value to it.

The next chapter takes you through...

Left arrow icon Right arrow icon

Key benefits

  • Teaches everything you need to create a complete Web 2.0-style web application with Django 1.0
  • Learn rapid development and clean, pragmatic design
  • No knowledge of Django required
  • Packed with examples and screenshots for better understanding

Description

Django is a high-level Python web framework that was developed by a fast-moving online-news operation to meet the stringent twin challenges of newsroom deadlines and the needs of web developers. It is designed to promote rapid development and clean, pragmatic design and lets you build high-performing, elegant web applications rapidly. Django focuses on automating as much as possible and adhering to the DRY (Don't Repeat Yourself) principle, making it easier to build high-performance web applications faster, with less code. This book will show you how to assemble Django's features and take advantage of its power to design, develop, and deploy a fully-featured web site. It will walk you through the creation of an example web application, with lots of code examples. Specially revised for version 1.0 of Django, the book starts by introducing the main design concepts in Django. Next, it leads you through the process of installing Django on your system. After that, you will start right away on building your social bookmarking application using Django. Various Django 1.0 components and sub-frameworks will be explained during this process, and you will learn about them by example. In each chapter, you will build one or more of the features that are essential in Web 2.0 applications, like user management, tags, and AJAX. You will also learn about good software development practices, such as keeping your application secure, and automating testing with unit tests. By the end of the book, you will have built a fully functional real-life Web 2.0 application, and learned how to deploy it to a production server.

Who is this book for?

This book is for web developers who want to learn to build a complete site with Web 2.0 features, using the power of a proven and popular development system, Django, but do not necessarily want to learn how the complete framework functions in order to do this. Basic knowledge of Python development is required for this book, but no knowledge of Django is expected.

What you will learn

  • Register your users through a user authentication system and manage them efficiently
  • Restrict user access to certain pages and protect against malicious input
  • Create tags to allow site visitors to classify, view, and share content easily
  • Create your own administration interface for proper monitoring of the web site
  • Enhance your user interface with AJAX and add flavors to your web site
  • Enable voting and commenting on content, and display popular content to site visitors
  • Build user networks; add friend management and invitation features for social networking
  • Create unit tests to automate the testing of code
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 10, 2009
Length: 272 pages
Edition : 1st
Language : English
ISBN-13 : 9781847196781
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Mar 10, 2009
Length: 272 pages
Edition : 1st
Language : English
ISBN-13 : 9781847196781
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 122.97
Learn Python Programming
$45.99
Django 1.0 Website Development
$43.99
JavaScript and JSON Essentials
$32.99
Total $ 122.97 Stars icon

Table of Contents

12 Chapters
Introduction to Django Chevron down icon Chevron up icon
Getting Started Chevron down icon Chevron up icon
Building a Social Bookmarking Application Chevron down icon Chevron up icon
User Registration and Management Chevron down icon Chevron up icon
Introducing Tags Chevron down icon Chevron up icon
Enhancing the User Interface with AJAX Chevron down icon Chevron up icon
Voting and Commenting Chevron down icon Chevron up icon
Creating an Administration Interface Chevron down icon Chevron up icon
Advanced Browsing and Searching Chevron down icon Chevron up icon
Building User Networks Chevron down icon Chevron up icon
Extending and Deploying Chevron down icon Chevron up icon
What Next? Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1
(15 Ratings)
5 star 53.3%
4 star 20%
3 star 13.3%
2 star 6.7%
1 star 6.7%
Filter icon Filter
Top Reviews

Filter reviews by




David Aug 09, 2010
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is, by far, one of the best introductory books out there when it comes to learning a new programming language or framework. If you are new to Django, I highly recommend that you start learning by reading this book.Ayman's codes work flawlessly, he covers all the basic fundamentals of Django and his writing style is easy to read. Explanation is very detailed, clear and yet very concise. Programming language authors tend to be unnecessarily verbose, but Ayman's description is easily understandable and to the point. Again, just get this book if you want to start learning Django.
Amazon Verified review Amazon
Rooster Jul 06, 2011
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm new to python and Django and had a Django project dropped in my lap. Although I'm using Django 1.3, this book was VERY helpful at getting me up to speed. Highly recommend if you're new to Django.
Amazon Verified review Amazon
Randall Degges Feb 27, 2010
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Let me preface this review by saying that I'm a professional software developer. I work for a mid-size communications company, and one of my tasks over the past 6 months has been investigating new web technologies to help us develop more modern, best-practices web applications.I started messing around with Django around 5 months ago, by reading the official website documentation and the online Django book (which were both great resources), but I felt that what was lacking from my experiences was a complete, best-practices walk through of building a full website with Django. As I'm sure most of you know, the best way to get comfortable with a new technology is to use it to build something. This is when I started checking out other Django books on Amazon and came across this one.This book walks you through building a complete social bookmarking site (similar to [...]) from scratch. The author does an amazing job of introducing you to Django and starts with the basics, working up to more and more complex things. I was surprised how well this book was written, and how easy it was to understand the code and explanations without much thinking. By Chapter 4 (45 pages in) you've already implemented a full user authentication system and user portal. You're able to display bookmarks, and much more. The author is not long-winded, and his writing style reminds me in many ways of Dennis Ritchie and Brian Kernighan (authors of the infamous book: 'The C Programming Language').As to what the book covers, it walks you through everything from the installation of Django to depolying Django on production servers once the site has been finished. It does an excellent job of discussing useful deployment techniques including caching, in only a few lines of code. Furthermore, the author will show you how to add ajax effects to your website to increase usability, using the jQuery framework (an incredibly popular and powerful javascript framework). It even covers usage of some jQuery plugins (like live searching of content).I frequently use this book as a reference guide (the cover is beginning to wear out) as the examples are really easy to navigate, and the descriptions are verbose.Overall, I'd say this book is a must read for any Django developer who wants to really grasp the inner workings of the Django framework. It's easy to read, very concise, and filled with useful, best-practices information that you will not want to miss.
Amazon Verified review Amazon
vrveerar Jul 22, 2010
Full star icon Full star icon Full star icon Full star icon Full star icon 5
To cut a long story short, this is the best introductory book I have seen on the Django framework. If you are a Django newbie with some rudimentary background in Python, this is the book for you. The book has a great flow which seamlessly connects the different aspects of the Django framework. This book allows you to get productive really fast. By chapter 5, you will already have known HTML forms and by chapter 6, you will be on your way integrating JQuery with Django.The one thing that this book has that other books dont is context. The author introduces us to various shortcuts in the framework, but only after showing what the long form is. The other thing that this book has in its favor is the language. The language is clear, simple English and not crammed with acronyms that many other books love to throw around (i.e, you will not need anything other than this book to understand this book).Kudos Ayman!
Amazon Verified review Amazon
Eugene Liang May 16, 2009
Full star icon Full star icon Full star icon Full star icon Full star icon 5
i'm about 1/3 through this book and i must say that the book is very easy to follow.I'm an intermediate programmer by the way, with some experience in c, php and a bit of python.If you want to have a good overview ( without too much in depth knowledge ) this is a good book to start with.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon