Version 4 (modified by 18 years ago) ( diff ) | ,
---|
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.
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?
- http://docs.python.org/tut/tut.html
- http://www.diveintopython.org/
- http://wiki.python.org/moin/BeginnersGuide/Programmers
Are there any books on Python?
Yes. http://wiki.python.org/moin/PythonBooks
Django questions
Which version should I use, the 0.95 release or the Subversion checkout?
The 0.95 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 setup.py
-- just make sure that the checkout is on your Python path.
Should I read the documentation on the djangoproject.com website, or djangobook.com?
Start with the documentation here. This is especially true if you're using 0.95, since the version that djangobook.com describes has some significant differences.
How do I extend a model? I want to subclass django.contrib.auth.models.User.
Can't do that right now, sorry. More: http://code.djangoproject.com/wiki/ModelInheritance
If I change my model, will manage.py syncdb
update my database table?
No. Sorry. You will have to do this manually. If you are not bothered about losing data, just do an sqlreset. Otherwise do this: Before changing the model, do python manage.py sqlall yourapp > old.sql
, then change your model and do the same sqlall yourapp > new.sql
compare the two files and you will see the difference that you will need to script for this.
What should I use for development -- the built-in server, mod_python, FastCGI?
It's generally best to use the built-in development server. It automatically reloads your Python source files when it detects changes. I beg to differ - the development server is fine for using before you decide on opting for django. Once you start *real* development, it is better to replicate the production environment as closely as possible.
What's the difference between null=True
and blank=True
in models?
null=True
tells Django that the DB schema should allow the storage of nulls in that field. blank=True
indicates that the field is optional (e.g. the admin will not complain if you leave it blank).
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: http://www.djangoproject.com/documentation/serialization/
Also see this helpful article from James Bennett (with bonus anti-Javascript-helpers rant!): http://www.b-list.org/weblog/2006/07/02/django-and-ajax
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: http://www.djangoproject.com/documentation/static_files/
I'm trying to install Django on Windows and something is weird.
Have you looked here? http://code.djangoproject.com/wiki/WindowsInstall
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.