-
Notifications
You must be signed in to change notification settings - Fork 23
/
HACKING
70 lines (52 loc) · 2.64 KB
/
HACKING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
======================================================================
HOW TO SET UP A LOCAL INSTALLATION OF METALAB OS TO CONTRIBUTE PATCHES
======================================================================
Please note: In case your python-2.7 specific tools have a "2" or "27" suffix,
you need to ensure to call the correct version of your tools in order to avoid
accidentally trying to run the MOS in python 3.x, which is currently
unsupported.
1. git clone git://github.com/Metalab/mos.git
2. On a Debian-based system:
apt-get install python-virtualenv
On OpenSuSE:
zypper install python-virtualenv
On any other system:
easy_install pip
pip install virtualenv
Alternatively, you can install the python2.7-virtualenv package for your
distribution, in case one exists.
3. Create the virtualenv (call it "devel"): virtualenv devel
4. Acivate the "devel" virtualenv: source devel/bin/activate
5. Install dependencies: pip install -r requirements.txt
(Note: Requires a C compiler and the python development headers.
Debian: apt-get install python-dev build-essential
OpenSuSE: zypper in -t pattern devel_C_C++ devel_python)
6. Install dev dependencies: pip install -r requirements-dev.txt
6b. Install pre-commit to ensure linting and code style: pre-commit install
7. Optional: Install the locale packages for de_DE.UTF-8
8. Put a temporary key into mos/settings/secret_key.py (SECRET_KEY='bla')
8a. python manage.py generate_secret_key (optional for development) and then
8b. Put output into secret_key.py (SECRET_KEY='<output>') (also optional)
9. python manage.py migrate
10. python manage.py createsuperuser
11. Load example data (optional, but recommended):
python manage.py loaddata core/fixtures/default_choices.json
python manage.py loaddata members/fixtures/default_choices.json
python manage.py loaddata members/fixtures/dummy_members.json
python manage.py loaddata cal/fixtures/events_2012-09-20.json
12. python manage.py runserver
13. Point your browser to http://127.0.0.1:8000/
14. Login with your freshly-created user account
Testing
=======
After you've made some changes to the code, rerun the test suite to check
that everything still works. You can do this from the project root by issuing:
./manage.py test
If you have a test failing, you can rerun only the app responsible to iterate
faster. E.g. if you have an error somewhere inside the cal package, do:
./manage.py test cal
Further Reading
===============
Virtualenv/Pip Basics: http://jontourage.com/2011/02/09/virtualenv-pip-basics/
Python 2.x Docs: https://docs.python.org/2/
Django 1.8.x Docs: https://docs.djangoproject.com/en/1.8/