This is a work in progress, answering questions that do indeed get asked frequently on the [irc://irc.freenode.net/django Django IRC channel] (#django on irc.freenode.net). Feel free to contribute, but try to keep it clear and concise. Please don't editorialize. There's also a helpful [http://www.djangoproject.com/documentation/faq/ official FAQ]. [[TOC]] = General Tips = * When asking for help in the channel, '''be as specific as possible''' in your request. "It doesn't work" is not sufficiently specific! * Standard problem-reporting advice: Describe 1) what you did, 2) what you expected to happen, and 3) what actually happened. * General problem-'''solving''' advice: Test all the things you think are true until you find the one that isn't. * Showing actual code is useful. For code longer than a line or two, use the pastebin: http://dpaste.com/ * Django has very good [http://www.djangoproject.com/documentation/ documentation]. Make sure you've checked it! = Python questions = == How do I learn Python if I'm new to programming? == #LearnPython1 * http://www.ibiblio.org/obp/thinkCSpy/ * http://wiki.python.org/moin/BeginnersGuide/NonProgrammers == How do I learn Python if I'm '''not''' new to programming? == #LearnPython2 * http://docs.python.org/tut/tut.html * http://www.diveintopython.org/ * http://wiki.python.org/moin/BeginnersGuide/Programmers == Are there any books on Python? == #PythonBooks Yes. http://wiki.python.org/moin/PythonBooks = Django questions = == Which version should I use, the 0.95.1 release or the Subversion checkout? == #WhichVersion 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 {{{setup.py}}} -- just make sure that the checkout is on your Python path. Django 0.96 will be released in the near future, and it will be recommended that production deployments stick to that release once it's out; there will be some backwards-incompatible changes in Django after 0.96, and the easiest migration plan is probably to run on 0.96 until that's done, then migrate your code all in one step. == Should I read the documentation on the djangoproject.com website, or djangobook.com? == #WhichDocs Start with the [http://www.djangoproject.com/documentation/ documentation] here. This is especially true if you're using 0.95.1, since the version the examples on djangobook.com are based on the development version of Django, which contains several features which were not present in the 0.95.1 release (but which will be present in the upcoming 0.96 release). == What does `'function' object has no attribute 'rindex'` mean? == #WeirdError1 This error is a telltale sign that you're trying to follow djangobook.com with a version of Django that's too old. See previous question. == How do I extend a model? I want to subclass django.contrib.auth.models.User. == #ModelSubclassing You can't do this at the moment, but model subclassing is being worked on. Also, see here http://www.b-list.org/weblog/2007/02/20/about-model-subclassing and here for instructions on extending the User model: http://www.djangobook.com/en/beta/chapter12/#cn226 == If I change my model, will {{{manage.py syncdb}}} update my database table? == #ModelChanges No, you'll need to manually change your database table. If you use `manage.py 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? == #WhichServer 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? == #NullVsBlank `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? == #Ajax 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 == Is there a free CMS available for Django? == #CMS At this point there is nothing well-established (like Plone, for instance). In practice, people mean so many different things by "CMS" that it may be hard to get a straight answer. This question is often asked by newcomers; one recommendation is to learn a bit of Django and see just how easy it is to make a site that does what you want. If you're in a big rush, there's always Ellington: http://www.ellingtoncms.com/ == What database should I use? == #WhichDB For development, most people find SQLite to be fastest and simplest to run with -- just make sure the database file and its directory are writeable by the owner of the web server process. For production, PostgreSQL is probably the most thoroughly-tested of the databases Django supports, but it's best to choose based on the needs of your applications; for example, applications which do very little writing of data to the DB will enjoy the speed of SQLite, but applications which involve many complex queries or which require robust concurrent-write features like transaction isolation will probably want to look at Postgres (and, of course, MySQL is often handy simply because many shared hosting providers have it set up by default). == The admin is working, but it can't find the Javascript and CSS and image files. == #AdminFiles 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. == #Windows Have you looked here? http://code.djangoproject.com/wiki/WindowsInstall == What editor is best for Django? == #WhichEditor [wiki:UsingVimWithDjango Vim]. No, wait, [wiki:Emacs Emacs]. A lot of people seem to like TextMate, too. == How do I customise the admin interface so all logged-in users can use it without screwing up anything? == #AllUsersAdmin The admin interface is designed for use by trusted site staff, not by any user -- if you don't trust a user with the level of access the admin application provides, you'll need to provide non-admin views for the actions you'd like to allow them to take. == How do I make extensive changes in the admin interface? == #ExtensiveChangesAdmin At the moment it's probably best not to; the admin app is fairly specialized and doesn't have a lot of places to customize behavior, so you'll usually end up writing less code by just rolling your own set of views. The newforms-admin branch, however, will significantly refactor the admin app to make customization much simpler. == I have created several users, but only the superuser is able to log into the admin == #OrdinaryUserCantLoginAdmin In .95 and prior releases, you cannot put a plain password when creating a new user in admin. You have to generate the password and put the hash. Or you have to do create_user in the shell. Or maybe you have not set the user as staff - a user without staff priveledges cannot login to admin. == When will the next release be out? -or- When will X branch be done? == #AreWeThereYet "When it's done" is the short answer. Fixed release dates are rarely set, but searching or browsing the developer list (http://groups.google.com/group/django-developers/) can be informative.