README.md 4.7 KB

Transparency: detail costs for libre price

It's still alpha-pre-ugly-looking and some strings are mentioning FAImaison. A more usable version may be integrated to coin.

Install it

Be sure to use python3

sudo apt-get install python virtualenv

Create a dedicated virtualenv:

virtualenv transparency_venv

Clone this repository:

git clone https://code.ffdn.org/jocelyn/transparency
cd transparency
source ../transparency_venv/bin/activate
pip install -r requirements.txt

Generate a secret key:

echo SECRET_KEY=`python -c "import string,random; uni=string.ascii_letters+string.digits+string.punctuation; print(repr(''.join([random.SystemRandom().choice(uni) for i in range(random.randint(45,50))])))"` > transparency/local_settings.py

Create database:

./manage.py migrate

Create administrator account:

./manage.py createsuperuser

Run it

Activate your virtualenv if needed / if it is not already done:

source ../transparency_venv/bin/activate

As far as you stay in development mode, you can activate DEBUG mode to avoid settings.ALLOWED_HOSTS error:

echo 'DEBUG=True' >> transparency/local_settings.py

Please read the Django deployment checklist before trying to push your transparency website in production.

Finally, run development server:

./manage.py runserver

Use it

Custom settings

All your custom settings should go to the transparency/local_settings.py file. By default it does not exists, thus you have to create it (but if you follow the installation guide above, it is already there). As its extension proves, it is a regular python file. The basic way to add your customized option is just to list your variables and their values:

MYVAR = "my custom value"

But, as it is a python file, you are free to do more complex stuff:

import totallyotherpackage

def my_custom_value_computation:
    toto = "tata"
    return toto + totallyotherpackage.funny_stuff()

MYVAR = my_custom_value_computation()

The rest of this section present some of the available options you may want to customize to fit your needs:

Name Description Default value Note
SECRET_KEY Django secret key. You should have set it during the setup, as described above. empty required
DEBUG Django debug mode False development mode only
ORGANIZATION_NAME Name of your organization, for which you want to edit transparency reports. "Transparency inc."
SETUP_COST_STAGGERING_MONTHS How many months do you want setup costs to be staggering accross 36

Two more options are customizable:

PROVISIONING_DURATIONS

This is a list of tuples, allowing you to define what provisionning durations will be available in the report forms.

The default values are:

PROVISIONING_DURATIONS = [
    (datetime.timedelta(days=365*3), '3 ans'),
    (datetime.timedelta(days=365*5), '5 ans'),
]

You can overwrite it, or adding new possibility, like this:

PROVISIONING_DURATIONS.append((datetime.timedelta(days=182), '6 mois'))

or

PROVISIONING_DURATIONS += [
    (datetime.timedelta(days=182), '6 mois'),
    (datetime.timedelta(days=365*8), '8 ans'),
]

RESOURCES_UNITS

This is a list of tuples, allowing you to define what resources units will be available in the report forms.

The default values are:

RESOURCES_UNITS = [
    ('a', 'A'),
    ('mbps', 'Mbps'),
    ('u', 'U'),
    ('ipv4', 'IPv4'),
    ('eth', 'ports'),
    ('services', 'abonnement')
]

As for the previous list, you can overwrite it or just append new values to it:

RESOURCES_UNITS = [
    ('server', 'Serveurs'),
    ('cube', 'Brique')
]