Blame view

README.md 1.19 KB
a9d173ce   Goutte   Add a bare-bones ...
1
2
3

# Travel Carbon Footprint Calculator

a1f12452   Antoine Goutenoir   Add the new conte...
4
- https://travel-footprint-calculator.apps.goutenoir.com  (private demo)
cc2f4661   Antoine Goutenoir   docs: update the ...
5
- http://travel-footprint-calculator.irap.omp.eu  (official)
a1f12452   Antoine Goutenoir   Add the new conte...
6
7


69f8c67f   Antoine Goutenoir   Doc check while r...
8
9
10
11
12
13
14
15
## Overview

- Content is in `content.yml`.
- Configuration is in `content.yml`.
- HTML templates are in `flaskr/templates`.
- Estimation Models are in `flaskr/laws`.
- Controllers are in `flaskr/controllers`.

a9d173ce   Goutte   Add a bare-bones ...
16
17
18

## Installation

cc2f4661   Antoine Goutenoir   docs: update the ...
19
20
21
Works on Python `2.7` up to `1.2` version.
Works on Python `3.7` from `1.3` version.

69f8c67f   Antoine Goutenoir   Doc check while r...
22

b18c8b9f   Antoine Goutenoir   Document.
23
24
25
26
### Create a virtual environment

You don't _have to_.  But it's useful for development.

cc2f4661   Antoine Goutenoir   docs: update the ...
27
    virtualenv .venv
b18c8b9f   Antoine Goutenoir   Document.
28
29
30

Then, source it to enable it.

cc2f4661   Antoine Goutenoir   docs: update the ...
31
    source .venv/bin/activate
b18c8b9f   Antoine Goutenoir   Document.
32
33
34

### Install the python dependencies

cc2f4661   Antoine Goutenoir   docs: update the ...
35
36
37
You will need Cython.

    sudo apt install cython
a9d173ce   Goutte   Add a bare-bones ...
38
    pip install -r requirements.txt
b18c8b9f   Antoine Goutenoir   Document.
39
40
41

### Create an empty database

a9d173ce   Goutte   Add a bare-bones ...
42
    python manage.py createdb
b18c8b9f   Antoine Goutenoir   Document.
43
44
45

### Configure the secrets

b9fc86c3   Antoine Goutenoir   Secure the admin ...
46
47
    cp .env.dist .env
    nano .env
a9d173ce   Goutte   Add a bare-bones ...
48

f48f4a8f   Antoine Goutenoir   Optimize a bottle...
49
50
51
### Configure permissions

`var/runs` must be writeable by the application.
cc2f4661   Antoine Goutenoir   docs: update the ...
52
It is the file-based part of the database.
f48f4a8f   Antoine Goutenoir   Optimize a bottle...
53

cc2f4661   Antoine Goutenoir   docs: update the ...
54
## Build CSS and JS (for prod)
f48f4a8f   Antoine Goutenoir   Optimize a bottle...
55
56
57
58

    flask assets build


a9d173ce   Goutte   Add a bare-bones ...
59
60
## Development

cc2f4661   Antoine Goutenoir   docs: update the ...
61
    source .venv/bin/activate
4a6ab110   Antoine Goutenoir   Sweep dust under ...
62
    source .env.flaskrun
a9d173ce   Goutte   Add a bare-bones ...
63
64
65
    flask run

Then, visit http://localhost:5000
a9d173ce   Goutte   Add a bare-bones ...