2005-07-13 21:08:56 +02:00
|
|
|
==========
|
|
|
|
Django FAQ
|
|
|
|
==========
|
|
|
|
|
2005-07-15 02:42:28 +02:00
|
|
|
General questions
|
|
|
|
=================
|
2005-07-13 21:08:56 +02:00
|
|
|
|
2005-07-15 02:42:28 +02:00
|
|
|
Why does this project exist?
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
Django grew from a very practical need: in our fast-paced newsroom, we often
|
2005-07-15 18:19:53 +02:00
|
|
|
have only a matter of hours to take a complicated Web application from
|
2005-07-15 02:42:28 +02:00
|
|
|
concept to public launch. Django was designed to not only allow us to
|
2005-07-15 18:19:53 +02:00
|
|
|
build Web applications quickly, but to allow us to build them right.
|
2005-07-13 21:08:56 +02:00
|
|
|
|
2005-07-15 02:42:28 +02:00
|
|
|
Django would not be possible without a whole host of open-source projects --
|
2005-07-15 21:41:54 +02:00
|
|
|
`Apache`_, `Python`_, and `PostgreSQL`_ to name a few -- and we're thrilled to be
|
2005-07-15 18:19:53 +02:00
|
|
|
able to give something back to the open-source community.
|
2005-07-13 21:08:56 +02:00
|
|
|
|
2005-07-15 21:41:54 +02:00
|
|
|
.. _Apache: http://httpd.apache.org/
|
|
|
|
.. _Python: http://www.python.org/
|
|
|
|
.. _PostgreSQL: http://www.postgresql.org/
|
|
|
|
|
|
|
|
|
2005-07-15 19:59:30 +02:00
|
|
|
What does "Django" mean, and how do you pronounce it?
|
|
|
|
-----------------------------------------------------
|
|
|
|
|
|
|
|
Django is named after `Django Reinhardt`_, a gypsy jazz guitarist from the 1930s
|
|
|
|
to early 1950s. To this day, he's considered one of the best guitarists of all time.
|
|
|
|
|
|
|
|
Listen to his music. You'll like it.
|
2005-07-13 21:08:56 +02:00
|
|
|
|
|
|
|
According to Wikipedia_, "Django is pronounced **zhane**-go (with a long 'a')."
|
|
|
|
|
2005-07-15 19:59:30 +02:00
|
|
|
.. _Django Reinhardt: http://en.wikipedia.org/wiki/Django_Reinhardt
|
2005-07-13 21:08:56 +02:00
|
|
|
.. _Wikipedia: http://en.wikipedia.org/wiki/Django_Reinhardt
|
|
|
|
|
|
|
|
Is Django stable?
|
|
|
|
-----------------
|
|
|
|
|
2005-07-15 18:19:53 +02:00
|
|
|
We've been using Django for almost two years. Sites built on Django have
|
2005-07-13 21:08:56 +02:00
|
|
|
weathered traffic spikes of over one million hits an hour, and at least
|
2005-07-15 18:19:53 +02:00
|
|
|
one Slashdotting. Yes, it's quite stable.
|
2005-07-13 21:08:56 +02:00
|
|
|
|
2005-07-15 02:42:28 +02:00
|
|
|
Does Django scale?
|
|
|
|
------------------
|
|
|
|
|
2005-07-15 18:19:53 +02:00
|
|
|
Yes. Compared to development time, hardware is cheap, and so Django is
|
2005-07-15 02:42:28 +02:00
|
|
|
designed to take advantage of as much hardware as you can throw at it.
|
2005-07-15 18:19:53 +02:00
|
|
|
Django ships with clean separation of the database layer from the
|
|
|
|
application layer and a simple-yet-powerful `cache framework`_.
|
2005-07-15 02:42:28 +02:00
|
|
|
|
|
|
|
.. _`cache framework`: http://www.djangoproject.com/documentation/cache/
|
|
|
|
|
2005-07-13 21:08:56 +02:00
|
|
|
Who's behind this?
|
|
|
|
------------------
|
|
|
|
|
2005-07-15 18:19:53 +02:00
|
|
|
Django was developed at `World Online`_, the Web department of a newspaper in
|
|
|
|
Lawrence, Kansas, USA.
|
|
|
|
|
2005-07-13 21:08:56 +02:00
|
|
|
`Adrian Holovaty`_
|
2005-07-15 02:42:28 +02:00
|
|
|
Adrian is a gypsy-jazz virtuoso, an amateur Beatles historian and a proud
|
|
|
|
Chicagoan. He's also a pretty decent programmer, with a knack for whipping
|
|
|
|
data into shape and putting it to work for the good of his fellow man.
|
|
|
|
Adrian is the lead developer at World Online and the man behind the code at
|
2005-07-15 18:19:53 +02:00
|
|
|
`chicagocrime.org`_.
|
2005-07-15 02:42:28 +02:00
|
|
|
|
2005-07-13 21:08:56 +02:00
|
|
|
`Simon Willison`_
|
2005-07-15 22:37:03 +02:00
|
|
|
Simon is a well-respected Web developer from England. He had a one-year
|
|
|
|
stint at World Online, during which time he and Adrian developed Django from
|
|
|
|
scratch. He's enthusiastic, he's passionate about best practices in Web
|
|
|
|
development, and he really likes squirrels. Probably to a fault. He went
|
|
|
|
back to England to finish his degree and is poised to continue doing big,
|
|
|
|
exciting things on the Web. Read his weblog at `simon.incutio.com`_.
|
2005-07-13 21:08:56 +02:00
|
|
|
|
|
|
|
`Jacob Kaplan-Moss`_
|
2005-07-15 02:42:28 +02:00
|
|
|
Jacob is a whipper-snapper from California who spends equal time coding and
|
|
|
|
cooking. He does Web development for World Online and actively hacks on
|
|
|
|
various cool side projects. He's contributed to the Python-ObjC bindings and
|
|
|
|
was the first guy to figure out how to write Tivo apps in Python. Lately
|
|
|
|
he's been messing with Python on the PSP.
|
2005-07-13 21:08:56 +02:00
|
|
|
|
2005-07-15 02:42:28 +02:00
|
|
|
`Wilson Miner`_
|
|
|
|
Wilson's design-fu makes us all look like rock stars. When not sneaking
|
|
|
|
into apartment complex swimming pools he is the Commercial Development
|
|
|
|
Director for World Online, which means he makes the money that pays all our
|
2005-07-15 18:19:53 +02:00
|
|
|
paychecks.
|
|
|
|
|
|
|
|
.. _`World Online`: http://code.djangoproject.com/wiki/WorldOnline
|
2005-07-13 21:08:56 +02:00
|
|
|
.. _`Adrian Holovaty`: http://www.holovaty.com/
|
2005-07-15 18:19:53 +02:00
|
|
|
.. _`chicagocrime.org`: http://www.chicagocrime.org/
|
2005-07-13 21:08:56 +02:00
|
|
|
.. _`Simon Willison`: http://simon.incutio.com/
|
2005-07-15 18:19:53 +02:00
|
|
|
.. _`simon.incutio.com`: http://simon.incutio.com/
|
2005-07-13 21:08:56 +02:00
|
|
|
.. _`Jacob Kaplan-Moss`: http://www.jacobian.org/
|
|
|
|
.. _`Wilson Miner`: http://www.wilsonminer.com/live/
|
|
|
|
|
2005-07-16 19:01:38 +02:00
|
|
|
Django appears to be a MVC framework, but you call the Controller the "view", and the View the "template". How come you don't use the standard names?
|
|
|
|
-----------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
That's because Django isn't strictly a MVC framework. We don't really belive in
|
|
|
|
any capital-M Methodoligies; we do what "feels" right. If you squint the right
|
|
|
|
way, you can call Django's ORM the "Model", the view functions the "View", and
|
|
|
|
the API automatically generated from the models the "Controller" -- but not
|
|
|
|
really.
|
|
|
|
|
|
|
|
So although we've been strongly influenced by MVC -- especially in the
|
|
|
|
separation of data from logic department -- we've also strayed from the path
|
|
|
|
where it makes sense.
|
|
|
|
|
|
|
|
Do you have any of those nifty "screencast" things?
|
|
|
|
---------------------------------------------------
|
|
|
|
|
|
|
|
They're in the works -- it's amazing how much time those things take! Stay tuned...
|
|
|
|
|
|
|
|
Installation questions
|
|
|
|
======================
|
2005-07-15 02:42:28 +02:00
|
|
|
|
|
|
|
How do I get started?
|
|
|
|
---------------------
|
|
|
|
|
2005-07-16 19:01:38 +02:00
|
|
|
#. `Download the code`_.
|
|
|
|
#. Install Django (read the `installation guide`_).
|
|
|
|
#. Walk through the tutorial_.
|
|
|
|
#. Check out the rest of the documentation_, and ask questions if you
|
|
|
|
run into trouble.
|
|
|
|
|
|
|
|
.. _`Download the code`: http://www.djangoproject.com/download/
|
|
|
|
.. _`installation guide`: http://www.djangoproject.com/documentation/install/
|
|
|
|
.. _tutorial: http://www.djangoproject.com/documentation/tutorial1/
|
|
|
|
.. _documentation: http://www.djangoproject.com/documentation/
|
|
|
|
|
|
|
|
How do I fix the "install a later version of setuptools" error?
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
Just run the ``ex_setup.py`` script in the Django distribution.
|
2005-07-15 02:42:28 +02:00
|
|
|
|
2005-07-15 22:37:03 +02:00
|
|
|
What are Django's prerequisites?
|
|
|
|
--------------------------------
|
|
|
|
|
|
|
|
Django requires Python_ 2.3 or later, Apache2_, and mod_python_. You'll
|
|
|
|
also need a database engine; PostgreSQL_ is recommended, and MySQL_ is
|
|
|
|
supported.
|
|
|
|
|
|
|
|
.. _Python: http://www.python.org/
|
|
|
|
.. _Apache2: http://httpd.apache.org/
|
|
|
|
.. _mod_python: http://www.modpython.org/
|
|
|
|
.. _PostgreSQL: http://www.postgresql.org/
|
|
|
|
.. _MySQL: http://www.mysql.com/
|
2005-07-16 19:01:38 +02:00
|
|
|
|
|
|
|
How do I install mod_python on Windows?
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
* If you are running Python 2.4, check out this `guide to mod_python & Python 2.3`_.
|
|
|
|
|
|
|
|
* For Python 2.3, grab mod_python from http://ww.mod_python.org/, the read
|
|
|
|
`Running mod_python on Apache on Windows2000`_.
|
|
|
|
|
|
|
|
* Also try this (not windows-specific) `guide to getting mod_python working`_.
|
|
|
|
|
|
|
|
.. _`guide to mod_python & Python 2.3`: http://www.lehuen.com/nicolas/index.php/2005/02/21/39-win32-build-of-mod_python-314-for-python-24
|
|
|
|
.. _`Running mod_python on Apache on Windows2000`: http://groups-beta.google.com/group/comp.lang.python/msg/139af8c83a5a9d4f
|
|
|
|
.. _`guide to getting mod_python working`: http://www.dscpl.com.au/articles/modpython-001.html
|
|
|
|
|
|
|
|
(Thanks to deelan for this info.)
|
|
|
|
|
|
|
|
Do I have to use mod_python?
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
In the first release, yes. However, WSGI_ support (which will let Django run
|
|
|
|
under FCGI, SCGI, medusa, etc.) is in the works; stay tuned!
|
|
|
|
|
2005-07-15 22:37:03 +02:00
|
|
|
.. _WSGI: http://www.python.org/peps/pep-0333.html
|
|
|
|
|
2005-07-16 19:01:38 +02:00
|
|
|
Will Django run under shared hosting (like TextDrive or Dreamhost)?
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
|
|
|
|
Right now, no, unless you can get your host to install mod_python. However, as
|
|
|
|
the previous question says, WSGI support is comming!.
|
|
|
|
|
|
|
|
Why do I get an error about importing DJANGO_SETTINGS_MODULE?
|
|
|
|
-------------------------------------------------------------
|
|
|
|
|
|
|
|
Make sure that:
|
|
|
|
|
|
|
|
* The environment variable DJANGO_SETTINGS_MODULE is set to a fully-qualifed
|
|
|
|
Python module (i.e. "mysite.settings.main").
|
|
|
|
|
|
|
|
* Said module is on ``sys.path`` (``import mysite.settings.main`` should work).
|
|
|
|
|
|
|
|
* The module doesn't contain syntax errors (of course).
|
|
|
|
|
|
|
|
* If you're using mod_python but *not* using Django's request handler,
|
|
|
|
you'll need to work around a mod_python bug related to the use of
|
|
|
|
``SetEnv``; before you import anything from Django you'll need to do
|
|
|
|
the following::
|
|
|
|
|
|
|
|
os.environ.update(req.subprocess_env)
|
|
|
|
|
|
|
|
(where ``req`` is the mod_python request object).
|
|
|
|
|
2005-07-15 02:42:28 +02:00
|
|
|
The admin interface
|
|
|
|
===================
|
|
|
|
|
2005-07-15 18:19:53 +02:00
|
|
|
The dynamically-generated admin site is ugly! How can I change it?
|
2005-07-15 18:29:26 +02:00
|
|
|
------------------------------------------------------------------
|
2005-07-15 02:42:28 +02:00
|
|
|
|
2005-07-15 22:37:03 +02:00
|
|
|
We think it's very purty, but if you don't agree, you can modify the admin
|
|
|
|
site's presentation by editing the CSS stylesheet and/or associated image files.
|
|
|
|
The site is built using semantic HTML, so any changes you'd like to make should
|
|
|
|
be possible by editing the CSS stylesheet. We've got a `guide to the CSS used in
|
|
|
|
the admin`_ to get you started.
|
2005-07-15 02:42:28 +02:00
|
|
|
|
|
|
|
.. _`guide to the CSS used in the admin`: http://www.djangoproject.com/documentation/admin_css/
|
|
|
|
|