Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Django - starting from ground zero - any advice?
67 points by samratjp on April 28, 2008 | hide | past | favorite | 41 comments
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

My current comprehension level:- Damaged by Java, love at first sight with python. Hungry for more django.




Thank you!


"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/


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


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


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


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


Some more..lots more at http://del.icio.us/tag/django.

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


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.


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.


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.


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.


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.


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.


It is my opinion that Java is not practical for scripting or web-based development, so I agree that people using it for that purpose will complain about it.

I definitely agree the majority of Java complaints are from people choosing the wrong tool for the job.


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/


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


Thanks for this!



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


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/


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 :)



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.


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.


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").


Of course not! I suppose I must have meant from the ground up :) Yet still amazed that caught more attention than anything else.


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.


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 :)!


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.


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.


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).


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.


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


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.


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


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.


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


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


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


Duh! Install PHP!

Kidding.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: