| 1 |
===================== |
|---|
| 2 |
How to install Django |
|---|
| 3 |
===================== |
|---|
| 4 |
|
|---|
| 5 |
This document will get you up and running with Django. |
|---|
| 6 |
|
|---|
| 7 |
Install Python |
|---|
| 8 |
============== |
|---|
| 9 |
|
|---|
| 10 |
Being a Python Web framework, Django requires Python. |
|---|
| 11 |
|
|---|
| 12 |
It works with any Python version 2.3 and higher. |
|---|
| 13 |
|
|---|
| 14 |
Get Python at www.python.org. If you're running Linux or Mac OS X, you probably |
|---|
| 15 |
already have it installed. |
|---|
| 16 |
|
|---|
| 17 |
Install Apache and mod_python |
|---|
| 18 |
============================= |
|---|
| 19 |
|
|---|
| 20 |
If you just want to experiment with Django, skip this step. Django comes with |
|---|
| 21 |
its own Web server for development purposes. |
|---|
| 22 |
|
|---|
| 23 |
If you want to use Django on a production site, use Apache with `mod_python`_. |
|---|
| 24 |
mod_python is similar to mod_perl -- it embeds Python within Apache and loads |
|---|
| 25 |
Python code into memory when the server starts. Code stays in memory throughout |
|---|
| 26 |
the life of an Apache process, which leads to significant performance gains |
|---|
| 27 |
over other server arrangements. Make sure you have Apache installed, with the |
|---|
| 28 |
mod_python module activated. Django requires Apache 2.x and mod_python 3.x. |
|---|
| 29 |
|
|---|
| 30 |
See `How to use Django with mod_python`_ for information on how to configure |
|---|
| 31 |
mod_python once you have it installed. |
|---|
| 32 |
|
|---|
| 33 |
If you can't use mod_python for some reason, fear not: Django follows the WSGI_ |
|---|
| 34 |
spec, which allows it to run on a variety of server platforms. See the |
|---|
| 35 |
`server-arrangements wiki page`_ for specific installation instructions for |
|---|
| 36 |
each platform. |
|---|
| 37 |
|
|---|
| 38 |
.. _Apache: http://httpd.apache.org/ |
|---|
| 39 |
.. _mod_python: http://www.modpython.org/ |
|---|
| 40 |
.. _WSGI: http://www.python.org/peps/pep-0333.html |
|---|
| 41 |
.. _How to use Django with mod_python: http://www.djangoproject.com/documentation/modpython/ |
|---|
| 42 |
.. _server-arrangements wiki page: http://code.djangoproject.com/wiki/ServerArrangements |
|---|
| 43 |
|
|---|
| 44 |
Get your database running |
|---|
| 45 |
========================= |
|---|
| 46 |
|
|---|
| 47 |
If you plan to use Django's database API functionality, you'll need to |
|---|
| 48 |
make sure a database server is running. Django works with PostgreSQL_ |
|---|
| 49 |
(recommended), MySQL_ and SQLite_. |
|---|
| 50 |
|
|---|
| 51 |
Additionally, you'll need to make sure your Python database bindings are |
|---|
| 52 |
installed. |
|---|
| 53 |
|
|---|
| 54 |
* If you're using PostgreSQL, you'll need the psycopg_ package (version 1 -- |
|---|
| 55 |
not version 2, which is still in beta). If you're on Windows, check out the |
|---|
| 56 |
unofficial `compiled Windows version`_. |
|---|
| 57 |
* If you're using MySQL, you'll need MySQLdb_. |
|---|
| 58 |
* If you're using SQLite, you'll need pysqlite_. Use version 2.0.3 or higher. |
|---|
| 59 |
|
|---|
| 60 |
.. _PostgreSQL: http://www.postgresql.org/ |
|---|
| 61 |
.. _MySQL: http://www.mysql.com/ |
|---|
| 62 |
.. _Django's ticket system: http://code.djangoproject.com/report/1 |
|---|
| 63 |
.. _psycopg: http://initd.org/projects/psycopg1 |
|---|
| 64 |
.. _compiled Windows version: http://stickpeople.com/projects/python/win-psycopg/ |
|---|
| 65 |
.. _MySQLdb: http://sourceforge.net/projects/mysql-python |
|---|
| 66 |
.. _SQLite: http://www.sqlite.org/ |
|---|
| 67 |
.. _pysqlite: http://initd.org/tracker/pysqlite |
|---|
| 68 |
|
|---|
| 69 |
Install the Django code |
|---|
| 70 |
======================= |
|---|
| 71 |
|
|---|
| 72 |
Installation instructions are slightly different depending on whether you're |
|---|
| 73 |
using the latest official version or the latest development version. |
|---|
| 74 |
|
|---|
| 75 |
It's easy either way. |
|---|
| 76 |
|
|---|
| 77 |
Installing the official version |
|---|
| 78 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 79 |
|
|---|
| 80 |
1. Download Django-0.90.tar.gz from our `download page`_. |
|---|
| 81 |
2. ``tar xzvf Django-0.90.tar.gz`` |
|---|
| 82 |
3. ``cd Django-0.90`` |
|---|
| 83 |
4. ``sudo python setup.py install`` |
|---|
| 84 |
|
|---|
| 85 |
Note that the last command will automatically download and install setuptools_ |
|---|
| 86 |
if you don't already have it installed. This requires a working Internet |
|---|
| 87 |
connection. |
|---|
| 88 |
|
|---|
| 89 |
This will install Django in your Python installation's ``site-packages`` |
|---|
| 90 |
directory. |
|---|
| 91 |
|
|---|
| 92 |
.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools |
|---|
| 93 |
|
|---|
| 94 |
Installing the development version |
|---|
| 95 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 96 |
|
|---|
| 97 |
1. Make sure you have Subversion_ installed. |
|---|
| 98 |
2. ``svn co http://code.djangoproject.com/svn/django/trunk/ django_src`` |
|---|
| 99 |
3. Symlink ``django_src/django`` so that ``django`` is within your Python |
|---|
| 100 |
``site-packages`` directory: |
|---|
| 101 |
|
|---|
| 102 |
``ln -s `pwd`/django_src/django /usr/lib/python2.3/site-packages/django`` |
|---|
| 103 |
|
|---|
| 104 |
(In the above line, change ``python2.3`` to match your current Python version.) |
|---|
| 105 |
|
|---|
| 106 |
You don't have to run ``python setup.py install``. |
|---|
| 107 |
|
|---|
| 108 |
When you want to update your code, just run the command ``svn update`` from |
|---|
| 109 |
within the ``django_src`` directory. |
|---|
| 110 |
|
|---|
| 111 |
.. _`download page`: http://www.djangoproject.com/download/ |
|---|
| 112 |
.. _Subversion: http://subversion.tigris.org/ |
|---|