Détail des coûts des services afin de permettre la pratique du prix libre.

Étienne Deparis a653681762 Be more chatty about the customizable options in the README il y a 6 ans
costs cfdacd5620 The resources units should be modifiable as a (local_)settings il y a 6 ans
publicsite c9ad73b50b Parler de brouillon plutôt que de « étude ou estimation » il y a 6 ans
transparency cfdacd5620 The resources units should be modifiable as a (local_)settings il y a 6 ans
.gitignore 5325018729 Use a local_settings.py file il y a 9 ans
README.md a653681762 Be more chatty about the customizable options in the README il y a 6 ans
manage.py 8886470a44 Initial commit il y a 9 ans
requirements.txt 3a6354c879 Handle description/notes as markdown il y a 9 ans

README.md

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. None 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
PROVISIONING_DURATIONS What provisionning durations will be available in the report forms. See below
RESOURCES_UNITS What resources units will be available in the report forms. See below

Both PROVISIONING_DURATIONS and RESOURCES_UNITS are lists of tuples. Their default values are respectively:

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

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

You can totally overwrite them:

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

Or just add new possibility, like this:

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

or this:

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

Warning: please note that the first element of each RESOURCES_UNITS tuple will be stored in the database as a string, which must be 10 characters long at most.

You must note too, that the first element of each PROVISIONING_DURATIONS tuple should be a datetime.timedelta object or, at least, something having a days attribute, storing an integer.