Version 8 (modified by Paul Bx <pb@…>, 8 years ago) (diff)

incorporated editorial comment

This is a work in progress, answering questions that do indeed get asked frequently on the Django IRC channel. Feel free to contribute, but try to keep it clear and concise. Please don't editorialize.

Python questions

How do I learn Python if I'm new to programming?

How do I learn Python if I'm not new to programming?

Are there any books on Python?


Django questions

Which version should I use, the 0.95.1 release or the Subversion checkout?

The 0.95.1 release is the most well-tested. That said, many people run sites based on a Subversion checkout happily. If you do use a Subversion checkout, note that you don't need to run -- just make sure that the checkout is on your Python path.

Should I read the documentation on the website, or

Start with the documentation here. This is especially true if you're using 0.95.1, since the version that describes has some significant differences.

How do I extend a model? I want to subclass django.contrib.auth.models.User.

Not at the moment, but model subclassing is being worked on.

If I change my model, will syncdb update my database table?

No, you'll need to manually change your database table. If you use sqlall on your app to produce a SQL file before editing your models, you can run it again afterwards and use the difference between the two to see what you need to change in the database.

What should I use for development -- the built-in server, mod_python, FastCGI?

It's generally easiest to use the built-in development server, since it automatically reloads your Python source files when it detects changes. (Some prefer to replicate the production environment as closely as possible, meaning that if their deployed project uses mod_python then their development server does as well.)

What's the difference between null=True and blank=True in models?

null=True means that the database will accept a NULL value for that field; blank=True means that Django's validation system won't complain about a missing value. If you use blank=True but not null=True you will need to have your code fill in a value before storage in the database -- specifying a default on a field, or putting something in the model's save method to generate a value are two good ways to handle this, and can be extremely useful when you want to calculate one field's value based on others.

I think Ajax is awesome! How do I do Ajax with Django?

Choose your favorite excellent Javascript library and go to it. Django provides serializers to JSON and XML, which you can read about in the documentation:

Also see this helpful article from James Bennett (with bonus anti-Javascript-helpers rant!):

What database should I use?

For development, most people find SQLite to be fastest and simplest to run with. (But make sure the database and its directory are writeable by the owner of the web server process!)

The admin is working, but it can't find the Javascript and CSS and image files.

You're running the development server, right? Read this:

I'm trying to install Django on Windows and something is weird.

Have you looked here?

What editor is best for Django?

Vim. No, wait, Emacs. A lot of people seem to like TextMate, too.

Is Django better than Ruby on Rails, Pylons, Turbogears, Zope, or chunky bacon?

Yes. It depends what you need and who you ask. ;)

Back to Top