README.md 1.84 KB
Newer Older
luxcem's avatar
luxcem committed
1 2 3 4 5 6 7 8 9 10 11 12 13
# LQDN RP

This project uses Django 1.11 and python >= 3.5

## Requirements

To run the project, start a virtual environment and install
requirements.txt requirements-dev.txt contains additional dependencies
for development

    $ pip install -r requirements.txt
    $ pip install -r requirements-dev.txt

14
To compile the CSS stylesheets and JS scripts, [install npm](https://www.npmjs.com/get-npm), then run
cynddl's avatar
cynddl committed
15 16 17 18 19 20 21
the following commands to run yarn (to fetch and install dependencies) and
webpack (to compile local assets)

    $ npm install -g yarn webpack
    $ yarn install
    $ webpack

22 23
In case you want to use the fixtures, you will need to install (git-lfs)[https://git-lfs.github.com/].

luxcem's avatar
luxcem committed
24 25 26
## Settings

Create a file in `project/settings/env.py` which contains django
27
settings for **DEBUG**, **SECRET_KEY** and **SITE_ID**.
luxcem's avatar
luxcem committed
28

29 30
For testing you can use `DEBUG = True`, a random string for
`SECRET_KEY` and `SITE_ID=1`.
luxcem's avatar
luxcem committed
31 32 33 34 35 36

In production you can use env variables with

```python
os.environ["DJANGO_DEBUG"]
os.environ["DJANGO_SECRET_KEY"]
37
os.environ["DJANGO_SITE_ID"]
luxcem's avatar
luxcem committed
38 39
```

40 41 42 43 44 45
You'll also need to define a DJANGO_ALLOWED_HOSTS containing
the FQDN of the RP before being able to run in production

If DEBUG is defined as True, ALLOWED_HOSTS is set to allow connections
from any hosts.

luxcem's avatar
luxcem committed
46 47
## Database

48
You can run database migrations with :
luxcem's avatar
luxcem committed
49

50
```sh
luxcem's avatar
luxcem committed
51
    $ python manage.py migrate
52 53
```

54 55 56 57 58
Groups are initialized with the following command:
```sh
    $ python manage.py init_groups
```

59 60 61 62 63 64
You can seed the database with a provided fixtures
located in apps/rp/fixtures/all_articles.json:

```sh
    $ python manage.py loaddata all_articles.json
```
luxcem's avatar
luxcem committed
65 66 67 68 69

## Dev server

To launch the dev server :

70
```sh
luxcem's avatar
luxcem committed
71
    $ python manage.py runserver
72
```
luxcem's avatar
luxcem committed
73 74 75 76 77

## Tests

To launch tests install requirements-tests.txt

78
```sh
luxcem's avatar
luxcem committed
79 80
    $ pip install -r requirements-tests.txt
    $ pytest
81
```
luxcem's avatar
luxcem committed
82 83 84

Coverage with

85
```sh
luxcem's avatar
luxcem committed
86
    $ pytest --cov=.
87
```