-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathHACKING
62 lines (46 loc) · 2.45 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
======================================================================
HOW TO SET UP A LOCAL INSTALLATION OF METALAB OS TO CONTRIBUTE PATCHES
======================================================================
1. git clone [email protected]:Metalab/mos.git && cd mos
2. On a Debian-based system:
apt-get install python3-venv python3-dev default-libmysqlclient-dev build-essential pkg-config
On OpenSuSE:
zypper install python-venv pkg-config
On any other system:
easy_install pip
pip install venv
3. Create the virtualenv (call it "devel"): python3 -m venv 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 --install-hooks
7. Optional: Install the locale packages for de_DE.UTF-8, like so https://unix.stackexchange.com/a/669800
8. Put a temporary key into mos/settings/secret_key.py (SECRET_KEY='bla')
8a. python3 manage.py generate_secret_key (optional for development) and then
8b. Put output into secret_key.py (SECRET_KEY='<output>') (also optional)
9. python3 manage.py migrate
10. python3 manage.py createsuperuser
11. Load example data (optional, but recommended):
python3 manage.py loaddata core/fixtures/default_choices.json
python3 manage.py loaddata members/fixtures/default_choices.json
python3 manage.py loaddata members/fixtures/dummy_members.json
python3 manage.py loaddata cal/fixtures/events_2012-09-20.json
12. python3 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: https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/
Python Docs: https://docs.python.org/
Django Docs: https://docs.djangoproject.com/