[Fixed]-Learning the Django framework

16👍

Are there any tips or tricks to remember the Django class library?

  1. Don’t try to remember every detail. Being able to search the documentation quickly is more useful IMHO.
  2. Get IPython and play with the shell.
  3. When you’re searching for something, try to categorise it first (for example, you want request/response related stuff – that’s HTTP, so it’s likely to live in django.http; you want context containers – that’s template-related, so it’s probably somewhere in django.template).
  4. Being able to dig through Django’s source code can be useful, too.

That’s how I’m doing it, and it works pretty well.

5👍

Have you considered web2py? Although Django, TurboGears, web2py are all good frameworks, I found the latter quite simple and flexible. You can see a comparison here (don’t worry about this document being on their website, it’s quite honest).

To answer your question, there are a couple of free IDE’s you can use and that will help you find your way:

  • Eclipse and Pydev is a nice environment, you benefit from Mylyn to define task and store related contexts to switch from one projet to another, and a lot of other add-ons;
  • Pyscripter, once configured properly, is very good at parsing your sources and providing you with contextual support.

Komodo is good too, but not free, and not open like Eclipse is.

You will find all the IDE’s in another question here.

4👍

Make a “cheat sheet” page. For the various components of Django where you’ll be writing code (e.g., urls, views, models), capture the common imports you’ll need (which you can gather from examples or reading other code), and add some short examples or links to the django docs. As you’re writing code, you can copy/paste the imports from your reference page.

That’s how I remember useful stuff like

from django.shortcuts import get_object_or_404
from django.shortcuts import render_to_response

The biggest hurdle for me is remembering the imports.

You can find cheat sheets if you Google around. But making your own can give you exactly what you need, and the act of typing it up will help you remember useful bits.

2👍

You should start reading the Django Book.

When you have a problem you want to solve (an itch to scratch), you will try to learn, and that knowledge will be in your head forever. Next time you have a problem, you’ll at least know where to look.


You can set up Eclipse with PyDev to get autocompletion. Also, remember to install the Django Docs, so you have the documentation right in the admin.

1👍

Just try create smth… like blog (I know it is obvious), building this simple example you will know ManyToMany relation (post’s tag), foreign key(user and his comments) and much more. If you will need help you could always google for answer or just ask on SO 😉

PS I am new in dJango too, so I know what i am talking 😉

1👍

Further to this answers, don’t be afraid to look at django’s sources when you’re stuck. It’s very well written and you can get tons of examples out of tests.

1👍

i recommend you to check out http://djangolinks.com/tag/tutorial/ all learning resource for django

Leave a comment