diff --git a/README.md b/README.md index 2480651..f583cf5 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,72 @@ # teknologr.io [![Build Status](https://travis-ci.org/Teknologforeningen/teknologr.io.svg?branch=develop)](https://travis-ci.org/Teknologforeningen/teknologr.io) [![Coverage Status](https://coveralls.io/repos/github/Teknologforeningen/teknologr.io/badge.svg?branch=develop)](https://coveralls.io/github/Teknologforeningen/teknologr.io?branch=develop) -Membership management system tailored for TF use +Membership teknologr/management system tailored for TF use ## Installation -Install prerequisites: +Clone the repository, go into the root directory of the project and do the following: +1. Install prerequisites + ``` sudo apt install libsasl2-dev python3-dev libldap2-dev libssl-dev libpq-dev + pip install virtualenv + ``` -Make sure that you have Python 3 installed and virtualenv to go with it. +1. Create a virtual environment + ``` + virtualenv -p /usr/bin/python3 venv + ``` -1. Create virtualenv: `virtualenv -p /usr/bin/python3 venv` -2. Activate venv: `source venv/bin/activate` -3. Install stuff with pip: `pip install -r requirements.txt` +1. Activate said virtual enviroment. **You need to do this for every new session.** + ``` + source venv/bin/activate + ``` -## Code style -pep8 check will be done when doing `python manage.py test`. -Linting only can be run with `python manage.py test test_pep8`. +1. Install prerequisites with pip + ``` + pip install -r requirements.txt + ``` + +1. Create a .env file + ``` + cp teknologr/.env.example teknologr/.env + ``` + During development you probably want to set `DEBUG=True`, and you might need to at least change the database location too to get it work out of the box. I suggest you remove the `DATABASE=...` completely to use the default database path (`teknologr/db.sqlite3`). + +1. Make sure you have the correct locale available on your system. The default locale used by Teknologr.io is `sv_FI.utf8`. + ``` + sudo locale-gen sv_FI.utf8 + sudo update-locale + ``` + +1. Run migrations to update the database schema + ``` + python teknologr/manage.py migrate + ``` + +1. Create a new superuser account + ``` + python teknologr/manage.py createsuperuser + ``` + +1. You are now ready to run an instance of Teknologr.io + ``` + python teknologr/manage.py runserver + ``` + View the page in your browser at `http://localhost:8000`. The admin site can be found at `http://localhost:8000/admin`. + + +## Tests +There is a number of unittests in files named `tests_*.py`. To run all the tests: +``` +python teknologr/manage.py test +``` + +To run only a specific test: +``` +python teknologr/manage.py test members.tests_models.GroupTest +``` + +A certain code style is required. Run the PEP8 test to check the style: +``` +python teknologr/manage.py test teknologr.tests_pep8 +``` diff --git a/teknologr/.env.example b/teknologr/.env.example index 0fb20f9..5d34a47 100644 --- a/teknologr/.env.example +++ b/teknologr/.env.example @@ -4,7 +4,7 @@ ALLOWED_HOSTS=[] # Whether or not requests to teknologr.io are forwarded through a proxy -IS_BEHIND_PROXY=True +IS_BEHIND_PROXY=False # Secret key, change it maybe?