Live data from Hacker News

Django - starting from ground zero - any advice?

news.ycombinator.com

31–40 of 42 posts

Re: Django - starting from ground zero - any advice?

#32
post #15

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 frien…

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

Re: Django - starting from ground zero - any advice?

#33

Earlier quoted context omitted.

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…

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.

Re: Django - starting from ground zero - any advice?

#34
post #7

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!

Re: Django - starting from ground zero - any advice?

#35
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.

Re: Django - starting from ground zero - any advice?

#36
post #31

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.

Re: Django - starting from ground zero - any advice?

#37

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

Re: Django - starting from ground zero - any advice?

#38
post #32
post #15

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 frien…

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.

Re: Django - starting from ground zero - any advice?

#39

"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

Re: Django - starting from ground zero - any advice?

#40
post #38
post #32

Earlier quoted context omitted.

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 o…

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