]> git.ozlabs.org Git - patchwork/blob - docs/HACKING
docs: Add requirements.txt for django 1.5/MySQL
[patchwork] / docs / HACKING
1 == Using virtualenv
2
3 It's always a good idea to use virtualenv to develop python software.
4
5 1. Install pip, virtualenv (python-pip, python-virtualenv packages)
6
7    Because we're going to recompile our dependencies, we'll also need
8    development headers:
9
10    - For the MySQL/MariaDB setups: mariadb-devel (Fedora)
11
12 2. Create a new virtual environement. Virtual environments are "instances" of
13    your system python, without any of the extra python packages installed.
14    Inside a virtual env, we'll just install the dependencies needed for
15    patchwork and run it from there.
16
17    Virtual envs are useful to develop and deploy patchwork against a "well
18    known" set of dependencies. They can also be used to test patchwork against
19    several versions of django, creating a separate virtual env per version.
20
21    $ virtualenv django-1.7
22
23    will create a virtual env called 'django-1.7' in eponymous directory.
24
25 3. Activate a virtual environment
26
27    $ sources django-1.7/bin/activate
28    (django-1.7)$
29
30    The shell prompt is preprended with the virtual env name.
31
32 4. Install the required dependencies
33
34    To ease this task, it's customary to maintain a list of dependencies in a
35    text file and install them in one go. One can maintain such a list of
36    dependencies per interesting configuration.
37
38    (django-1.7)$ pip install -r docs/requirements-django-1.7-mysql.txt
39
40    Of course, this is a one-time step, once installed in the virtual
41    environment, no need to to install the requirements everytime.
42
43 5. Now one can run patchwork within that environment
44
45    (django-1.7)$ ./apps/manage.py --version
46    1.7
47    (django-1.7)$ ./apps/manage.py runserver
48
49 6. To exit the virtual environment
50
51    (django-1.7)$ deactivate
52    $