18

Django is a great framework, but after seeing a couple of learning videos I realized those people have great knowledge of the Django framework and libraries, which enable them to use any class very easily.

I just wonder how can one remember all those classes and function in an environment where IDEs are not powerful enough.

What should be the learning process?

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

Any suggestion would be a great help for lots of people like me.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Software Enthusiastic
  • 21,163
  • 15
  • 55
  • 66

7 Answers7

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.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Cat Plus Plus
  • 113,388
  • 26
  • 185
  • 215
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.

Community
  • 1
  • 1
RedGlyph
  • 10,439
  • 5
  • 34
  • 44
  • Correction: **Komodo Edit** is free and open source. – Sridhar Ratnakumar Oct 04 '09 at 02:07
  • 1
    Yes, Komodo Edit is part of Open Komodo, and is free (http://www.openkomodo.com/). But it is a mere editor, far less powerful than the Komodo IDE, which was what I actually meant (http://www.activestate.com/komodo/). The latter is not free unfortunately, although not so expensive especially if you use it also for the other languages it supports. That said, Eclipse+Pydev or Pyscripter (with Rpyc) are usually comfortable enough. – RedGlyph Oct 04 '09 at 11:24
  • Ah, I noticed the latest versions of PyScripter are hosted on Google Code and *not by MMM Experts anymore*. And there are instructions on **how to use it with Django**! Here is the link: http://code.google.com/p/pyscripter (seems I finally got the HTML markdown right in my text...) – RedGlyph Oct 04 '09 at 11:37
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.

Dave W. Smith
  • 21,640
  • 4
  • 33
  • 38
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.

Esteban Küber
  • 33,970
  • 13
  • 78
  • 96
1

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

soField
  • 2,245
  • 9
  • 34
  • 42
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 ;)

IProblemFactory
  • 8,777
  • 5
  • 44
  • 62
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.

Dmitry Shevchenko
  • 28,728
  • 10
  • 52
  • 62