Coder Social home page Coder Social logo

writing-your-first-django-app's Introduction

2011-02-22

This is taken from "Writing your first Django app" at http://goo.gl/t6Jc
for Django version 1.2.5, which was the current stable version on this
date. THE NEXT VERSION HAS CHANGES THAT WILL BE NEEDED TO MAKE THIS
RUN UNDER VERSION 1.3.

The reason for providing the complete final code for the tutorial is
that I found the tutorial hard to follow in places. When I first started,
for example, I was confused in Part I by the section "Playing with 
the API" because it wasn't obvious why the authors were using the
command line to create and modify objects, rather than the admin. By
skipping it, I missed a lot. The second thing that threw me was all
the work writing views that gets thrown away for generic views and
the careful reading that was needed to make all the adjustments that
were described but not spelled out fully. 

The biggest reason, though, was that I had been trying to write my
own application by cribbing from the tutorial and finding that some
things worked, but others didn't, even after I went back and corrected
by initial attempts at translation. I finally decided that I just really
needed to work through the tutorial from beginning to end until it worked
as described and only then should I start using it as a reference for
my own apps. 

If this helps you to get the tutorial example working, 
I suggest going back and working through the tutorial
from scratch, cutting and pasting as you go. You can come back to
these files if you get lost, but you will find that the big
benefit from the material comes with following along step
by step, not just from reading the finished code.

You will need to edit settings.py to change TEMPLATE_DIRS from 

    '/PATH_TO_PARENT_DIRECTORY/tutor/templates',

to reflect the directory to which you have cloned this repository,
such as

    '/home/jason/tutor/templates',

(Windows users, please make the appropriate adjustments.)

My suggestion is to make no other changes until you have the example
code working.

The sample sqlite3 database has a couple of poll objects to get you
started.

You should be able to access the following pages after starting the
development server with:

$ python manage.py runserver

by pointing your browser to:

http://localhost:8000/admin/
http://localhost:8000/polls/
http://localhost:8000/polls/1/
http://localhost:8000/polls/2/

and by following the links. You will get an error page for 

http://localhost:8000/

because no default page has been defined.

For the admin:
username: rc
password: demo

writing-your-first-django-app's People

Contributors

technocrat avatar

Watchers

Nikitha Suryadevara avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.