Django

Code

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

Revision 4455, 5.1 kB (checked in by rmunn, 2 years ago)

Merged revisions 4186 to 4454 from trunk.

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 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: ../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.1 --
55   not version 1.0 or version 2, which is still in beta). If you're on Windows,
56   check out the 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.95.tar.gz from our `download page`_.
81 2. ``tar xzvf Django-0.95.tar.gz``
82 3. ``cd Django-0.95``
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 and may cause problems on Python 2.5. If you run into problems,
88 try using our development version by following the instructions below. The
89 development version no longer uses setuptools nor requires an Internet
90 connection.
91
92 The command will install Django in your Python installation's ``site-packages``
93 directory.
94
95 .. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
96
97 Installing the development version
98 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99
100 If you'd like to be able to update your Django code occasionally with the
101 latest bug fixes and improvements, follow these instructions:
102
103 1. Make sure you have Subversion_ installed.
104 2. Check out the Django code into your Python ``site-packages`` directory.
105    On Linux / Mac OSX / Unix, do this::
106
107        svn co http://code.djangoproject.com/svn/django/trunk/ django_src
108        ln -s `pwd`/django_src/django /usr/lib/python2.3/site-packages/django
109
110    (In the above line, change ``python2.3`` to match your current Python version.)
111
112    On Windows, do this::
113
114        svn co http://code.djangoproject.com/svn/django/trunk/django c:\Python24\lib\site-packages\django
115
116 3. Copy the file ``django_src/django/bin/django-admin.py`` to somewhere on your
117    system path, such as ``/usr/local/bin`` (Unix) or ``C:\Python24\Scripts``
118    (Windows). This step simply lets you type ``django-admin.py`` from within
119    any directory, rather than having to qualify the command with the full path
120    to the file.
121
122 You *don't* have to run ``python setup.py install``, because that command
123 takes care of steps 2 and 3 for you.
124
125 When you want to update your copy of the Django source code, just run the
126 command ``svn update`` from within the ``django`` directory. When you do this,
127 Subversion will automatically download any changes.
128
129 .. _`download page`: http://www.djangoproject.com/download/
130 .. _Subversion: http://subversion.tigris.org/
Note: See TracBrowser for help on using the browser.