Django

Code

root/django/branches/unicode/docs/install.txt

Revision 5580, 6.8 kB (checked in by mtredinnick, 1 year ago)

unicode: Merged changes from trunk up to [5579].

Line 
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 http://www.python.org. If you're running Linux or Mac OS X, you
15 probably already have it installed.
16
17 Install Apache and mod_python
18 =============================
19
20 If you just want to experiment with Django, skip ahead to the next
21 section; Django includes a lightweight web server you can use for
22 testing, so you won't need to set up Apache until you're ready to
23 deploy Django in production.
24
25 If you want to use Django on a production site, use Apache with `mod_python`_.
26 mod_python is similar to mod_perl -- it embeds Python within Apache and loads
27 Python code into memory when the server starts. Code stays in memory throughout
28 the life of an Apache process, which leads to significant performance gains
29 over other server arrangements. Make sure you have Apache installed, with the
30 mod_python module activated. Django requires Apache 2.x and mod_python 3.x.
31
32 See `How to use Django with mod_python`_ for information on how to configure
33 mod_python once you have it installed.
34
35 If you can't use mod_python for some reason, fear not: Django follows the WSGI_
36 spec, which allows it to run on a variety of server platforms. See the
37 `server-arrangements wiki page`_ for specific installation instructions for
38 each platform.
39
40 .. _Apache: http://httpd.apache.org/
41 .. _mod_python: http://www.modpython.org/
42 .. _WSGI: http://www.python.org/peps/pep-0333.html
43 .. _How to use Django with mod_python: ../modpython/
44 .. _server-arrangements wiki page: http://code.djangoproject.com/wiki/ServerArrangements
45
46 Get your database running
47 =========================
48
49 If you plan to use Django's database API functionality, you'll need to
50 make sure a database server is running. Django works with PostgreSQL_,
51 MySQL_, Oracle_ and SQLite_ (the latter doesn't require a separate server to
52 be running).
53
54 Additionally, you'll need to make sure your Python database bindings are
55 installed.
56
57 * If you're using PostgreSQL, you'll need the psycopg_ package. Django supports
58   both version 1 and 2. (When you configure Django's database layer, specify
59   either ``postgresql`` [for version 1] or ``postgresql_psycopg2`` [for version 2].)
60
61   If you're on Windows, check out the unofficial `compiled Windows version`_.
62
63 * If you're using MySQL, you'll need MySQLdb_, version 1.2.1p2 or higher.
64   You will also want to read the database-specific notes for the `MySQL backend`_.
65
66 * If you're using SQLite, you'll need pysqlite_. Use version 2.0.3 or higher.
67
68 * If you're using Oracle, you'll need cx_Oracle_, version 4.3.1 or higher.
69
70 .. _PostgreSQL: http://www.postgresql.org/
71 .. _MySQL: http://www.mysql.com/
72 .. _Django's ticket system: http://code.djangoproject.com/report/1
73 .. _psycopg: http://initd.org/tracker/psycopg
74 .. _compiled Windows version: http://stickpeople.com/projects/python/win-psycopg/
75 .. _MySQLdb: http://sourceforge.net/projects/mysql-python
76 .. _SQLite: http://www.sqlite.org/
77 .. _pysqlite: http://initd.org/tracker/pysqlite
78 .. _MySQL backend: ../databases/
79 .. _cx_Oracle: http://www.python.net/crew/atuining/cx_Oracle/
80 .. _Oracle: http://www.oracle.com/
81
82 Remove any old versions of Django
83 =================================
84
85 If you are upgrading your installation of Django from a previous version,
86 you will need to uninstall the old Django version before installing the
87 new version.
88
89 If you installed Django using ``setup.py install``, uninstalling
90 is as simple as deleting the ``django`` directory from your Python
91 ``site-packages``.
92
93 If you installed Django from a Python egg, remove the Django ``.egg`` file,
94 and remove the reference to the egg in the file named ``easy-install.pth``.
95 This file should also be located in your ``site-packages`` directory.
96
97 .. admonition:: Where are my ``site-packages`` stored?
98
99     The location of the ``site-packages`` directory depends on the operating
100     system, and the location in which Python was installed. To find out your
101     system's ``site-packages`` location, execute the following::
102
103         python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
104
105     (Note that this should be run from a shell prompt, not a Python interactive
106     prompt.)
107
108 Install the Django code
109 =======================
110
111 Installation instructions are slightly different depending on whether you're
112 using the latest official version or the latest development version.
113
114 It's easy either way.
115
116 Installing the official version
117 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118
119     1. Check the `distribution specific notes`_ to see if your
120        platform/distribution provides official Django packages/installers.
121        Distribution-provided packages will typically allow for automatic
122        installation of dependancies and easy upgrade paths.
123
124     2. Download the latest release from our `download page`_.
125
126     3. Untar the downloaded file (e.g. ``tar xzvf Django-NNN.tar.gz``).
127
128     4. Change into the downloaded directory (e.g. ``cd Django-NNN``).
129
130     5. Run ``sudo python setup.py install``.
131
132 The command will install Django in your Python installation's ``site-packages``
133 directory.
134
135 .. _distribution specific notes: ../distributions/
136
137 Installing the development version
138 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139
140 If you'd like to be able to update your Django code occasionally with the
141 latest bug fixes and improvements, follow these instructions:
142
143 1. Make sure you have Subversion_ installed.
144 2. Check out the Django code into your Python ``site-packages`` directory.
145
146    On Linux / Mac OSX / Unix, do this::
147
148        svn co http://code.djangoproject.com/svn/django/trunk/ django_src
149        ln -s `pwd`/django_src/django SITE-PACKAGES-DIR/django
150
151    (In the above line, change ``SITE-PACKAGES-DIR`` to match the location of
152    your system's ``site-packages`` directory, as explained in the
153    "Where are my ``site-packages`` stored?" section above.)
154
155    On Windows, do this::
156
157        svn co http://code.djangoproject.com/svn/django/trunk/django c:\Python24\lib\site-packages\django
158
159 3. Copy the file ``django_src/django/bin/django-admin.py`` to somewhere on your
160    system path, such as ``/usr/local/bin`` (Unix) or ``C:\Python24\Scripts``
161    (Windows). This step simply lets you type ``django-admin.py`` from within
162    any directory, rather than having to qualify the command with the full path
163    to the file.
164
165 You *don't* have to run ``python setup.py install``, because that command
166 takes care of steps 2 and 3 for you.
167
168 When you want to update your copy of the Django source code, just run the
169 command ``svn update`` from within the ``django`` directory. When you do this,
170 Subversion will automatically download any changes.
171
172 .. _`download page`: http://www.djangoproject.com/download/
173 .. _Subversion: http://subversion.tigris.org/
Note: See TracBrowser for help on using the browser.