

Django - starting from ground zero - any advice? - samratjp

I am new to Python/Django and have been hacking away happily with it. Any good tutorials out there that google isn't picking up in the first few pages or so? I know it's not as popular as Rails (yet!) to have crazy books with scratch to painted up pretty sites, but any good learn by doing examples out there (besides the few obvious first few pages of google and the Django official book). Bonus: If you are such a passionate python/django hacker, why don't you share with us your wonderful tutorial skills and write a b0|0k<p>My current comprehension level:- Damaged by Java, love at first sight with python. Hungry for more django.
======
kyro
<http://code.djangoproject.com/wiki/Tutorials>

and

[http://www.b-list.org/weblog/2006/nov/16/django-tips-get-
mos...](http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-
generic-views/)

<http://www.b-list.org/weblog/2007/sep/04/django-accelerated/>

<http://www.slideshare.net/simon/advanced-django/>

<http://djangoplugables.com/>

Those are some sites I've come across when I was, and still am, learning
Django. Good luck.

~~~
samratjp
Thank you!

------
pistoriusp
"If you want to get smart - get doing." Code, code as much as you can and try
and sway off the beaten path. My first project led me into middleware, user
profiles and custom fields. I would also suggest that you rather use trunk
than the 0.96 release.

Also, because no one has mentioned it before: <http://djangobook.com/>

~~~
flashgordon
wow surprisingly thats what my first project led me to as well...

~~~
pistoriusp
Maybe it's not that far off the beaten path, and I assumed that it was because
it isn't that well documented... _shrug_

------
saurabh
The best way to learn is by example. This is a good way to start.
<http://www.7days7apps.com/>

Get the code here using svn:

svn checkout <http://7days7apps.googlecode.com/svn/trunk/> 7days7apps-read-
only

~~~
samratjp
I love this already - just the right mix of examples and agile learning.
Perfect! Thanks!

------
maheshcr
Some more..lots more at <http://del.icio.us/tag/django>.

I also like the APress book Definitive Guide to Django by Adrian & Jacob.

------
KB
Best place to start would be to read the free online book written by the
authors of Django.

<http://djangobook.com>

I would also recommend "Python Pocket Reference" (3rd Edition) by O'Reilly. It
really helped me get up to speed with Python in a short amount of time.

Good Luck.

------
codesurgeon
I like the post and the replies. Hacker News seems to be a really good forum
for inquiries of this nature.

But what on earth is "Damaged by Java" supposed to convey? I guess you find
Python with Django to suit your particular needs better than Java, no reason
to play down the latter though.

~~~
mrtron
I modded you up because I agree, but I also was in the situation where I was
damaged by Java so I feel the need to respond.

Java is good, but I always felt so constrained when writing code. It just felt
like I had to write so much extra junk code like getters and setters that it
made rapid prototyping which I do a lot a hassle.

Python was a breath of fresh air, and is a great language for hacking around
in. Java is very useful and I still use it quite a bit.

~~~
samratjp
Python was such fresh air that I felt Java was bloatware; no offense to Java,
but I really loved the agile development with python that I downplayed java.

~~~
codesurgeon
No hard feelings and thanks for the clarification.

I think Python is a slick language and tool and its Benevolent Dictator for
Life is a knowledgeable and nice person. I ran into him while interning at
Google (worked on the same team and almost did a project related to one of
his).

I guess what I don't like is that devs of all kinds of backgrounds have been
downplaying Java ever since its inception and in my view not always rightfully
so.

My (admittedly subjective) impression is that this has been happening beyond
the usual "religious programming language wars".

Developers writing native code are still complaining about Java's (supposedly)
terrible performance, admin-focused scripters for lack of immediacy and web-
focused coders for being bloated and not supportive of "agile procedure". I'd
just like to point out that this language has become the "working man's
language" and with it spans a wide variety of domains and features an
incredibly large community. Perf-wise, I doubt that there is currently another
language VM that has been better studied, optimized and supported than the JVM
(Azul, anyone?).

Of course, the truth is that Java is a tool like every other language and has
its proper uses and domains where I'd also pick a different weapon of choice.

~~~
samratjp
Quite true really - but since I am rather new and ignorant to the various
language religiosity, it's good to know that Java is indeed a very versatile
language, but, only if used for the right job. Yes, quite true that many
complaints arise from using the wrong weapon indeed. I just felt for the
moment that Django seemed to be a rifle and java, a shotgun.

------
sverrejoh
Also, if you want to keep up with the Django community and changes to Django
code, I would recommend the "This Week in Django" podcast.

Read more about it in Michael Triers blog at <http://blog.michaeltrier.com/>

~~~
simonw
Seconded - really excellent podcast, also a great way of catching up on what's
happened in the past week.

------
ra
Unless you're already a Python whizz, "Python Essential Reference" is a must.

I found poking around inside Satchmo incredibly helpful for finding quality
code examples. (<http://www.satchmoproject.com/>).

Other than that, just do the tutorial on the djangoproject site, and subscribe
to the django-users group on google groups.

have fun!

Rich

edit: Also there's a feed called the django aggregator. A little noisy at
times, but worth scanning through couple of days:
<http://www.djangoproject.com/community/>

~~~
samratjp
Satchmo's pretty cool. And just fyi to other new pythonistas(?) - the new
o'reilly book Learning Python is good, but thought it was a bit too long and
expensive; the online tutorials fare very well indeed :)

------
vikram
[http://showmedo.com/videos/video?name=1100000&fromSeries...](http://showmedo.com/videos/video?name=1100000&fromSeriesID=110)
<http://showmedo.com/videos/series?name=v7kABKL6R>
<http://blog.disqus.net/2007/03/11/a-django-primer/>
[http://www-128.ibm.com/developerworks/linux/library/l-django...](http://www-128.ibm.com/developerworks/linux/library/l-django/?ca=dgr-
btw01DjangoAndPython)

~~~
samratjp
The showmedo was pretty good; also thumbs for the disqus one, seeing they have
been Django substantially!

------
menloparkbum
<http://en.wikipedia.org/wiki/Ground_zero>

~~~
jrockway
Good point; I think he meant "square one" instead of "ground zero"

Oh... and when he's done he'll be on "cloud nine".

English is weird.

~~~
davidw
All languages are weird, but pointing out a fairly substantial error is not a
bad thing; unless it's done in a mean spirited way.

~~~
jrockway
I don't think this is a "fairly substantial" error. I understood what he
meant, and I wasn't offended... so it's just a slight problem (like forgetting
a comma, or using "affect" instead of "effect").

------
cjl
If you have about 30 minutes to kill, you can try my tutorial:

<http://www.instantdjango.com>

It's not that great, but it covers the basics. Also, it includes a no-
installation-required django environment for Windows, which you can even run
from a USB flash drive.

I will be uploading an update sometime in the next few days now that qsrf has
been merged with trunk, but it's still quite usable as is.

------
thingsilearned
It takes very little time to learn how to do things in Django but it does take
a long time to learn how to do them the best way.

Don't worry when you start about doing them the best way. Its often better to
make the mistakes (while still exploring) and your next app will just be that
much better.

Good luck and great choice :)!

------
mrtron
Ignore the built in admin in the beginning. It is far more useful/flexible
once you know how Django works in and out. I have seen quite a few people rely
too much on it to do things that should have been implemented separately.

------
vikram
I had a look at django recently. Last week actually. My advise would be to
start coding. Make sure the thing is installed right and that you can talk to
your database of choice and that your examples run.

Then start coding. It's not too difficult. Some of the things with template
engine are a bit funny, so try and not write any big code here, move it to the
view/model. But otherwise remember that google is your friend.

My app is a geo based app, but I couldn't get geodjango to play nice. So I
just installed the libs and went with that.

~~~
mrtron
The template engine is intentionally designed so you have to move any major
logic or 'business rules' to the view and out of the template. This can be a
different style than other web languages in the beginning, but trust me you
will be thankful in 6 months when you are adding a new feature that you don't
have to touch the templates (or not much).

~~~
vikram
I think in most cases when you add a feature you end up touching everything in
each of the layers.

It's only when you want to change something that it's possible that you might
just be restricted to one layer.

I think the idea of the template is that you have one template and many views,
and possibly that a template can be created of many different smaller
templates, e.g. header, footer, sidebar.

Here is an example of something that I wanted to do with a very specific
template that wouldn't be used on any other page.

My model gives distance in meters, for each of the objects and I wanted to
display it in miles. So I had to add a new method to the model dist_miles.
Instead of just saying round(cinema.dist / 1600, 2) in the template.

I've only been using django for a week now so its quite possible that I'm
going about it all wrong.

~~~
GrumpySimon
Yep, all wrong :) You want a custom filter:
<http://www.djangoproject.com/documentation/templates_python/>

~~~
mrtron
Other types of complexity can be handled in custom template tags too.

The easy way to look at them is you could write your own 'filter' or 'count'
or any of the tags you see.

However, most of your needs can be met by the built in filters.

------
omfut
Does anyone know of good tutorial on django and flex integration. Also,
something about javascript and django. Couldnt find any good tutorial. Thanks

~~~
goofygrin
well flex = a flash widget and javascript is just output as part of the
template/html.

Are you talking javascript <-> flex, flex <-> HttpService in django and/or
django with ajax?

Frankly I find ajax/flex/flash with django to be easier than asp.net webforms
since you just setup a route (REST-like if you want) and then "post" to it and
return some data and use it in javascript.

In ASP.NET it's not all that hard, but I just have to remove any master pages
and remember to clear out the .aspx page contents if I'm not returning HTML.

I really don't see how it's any different than any other ajax + some server
technology, so if you're used to ajax <-> php, then ajax <-> django is no
problem.

------
misterbwong
Thanks for posting this topic. I'm in the exact same place as you and all
these comments have been very helpful.

------
wallflower
Look at a lot of examples and use the example code to help build a small web
application that would be useful for you.

------
mattdennewitz
if you get stuck, hop into #django on irc.freenode.net. theres always someone
around who can help out

------
jdroid
Duh! Install PHP!

Kidding.

