See the up to date instructions on Gitlab.
See the Makefile for all the targets.
make run and open your browser on localhost:8000.
You must create a user (see management commands to create and delete superusers in the next section).
This command is only to be run on a local machine. If you run it on a server, you won’t be able to access Abelujo from the internet. But you could do:
./manage.py runserver PORT:IP
Put your ip address in the file IP.txt (root of the project) and the port in PORT.txt:
echo "my.ip" > IP.txt
echo "8888" > PORT.txt
and run the server with make gunicorn.
To restart the application, use make gunicorn-restart.
the asyncronous task runner with:
make taskqueue
Note: this method to make an inventory is deprecated.
If you are subscribed to Dilicom, see `Dilicom documentation <dilicom.html >`_.
We use gunicorn and whitenoise to serve static files.
Sentry helps immensely in being notified of runtime errors.
The settings read the Sentry token in a sentry.txt file if present.
Test with python manage.py raven test.
This is installed with make debian:
sudo apt-get install nodejs-legacy
(but you can stay with SQLite, it works with millions of records)
Abelujo uses by default an SQLite database, you don’t have to configure a Postgresql one.
We need to create a database with the following steps:
sudo su - postgres
createdb abelujo_db
createuser abelujo_user -P # and enter a password.
Now call a postgresql prompt:
psql
GRANT ALL PRIVILEGES ON DATABASE abelujo_db TO abelujo_user;
Now we have a postgre database and a user (“postgres”) to use it. We just have to put it in our abelujo/settings.py.
Create the db:
./manage.py syncdb
Note: if we have “authentication peer failed for user XXX”, edit the file /etc/postgresql/9.3/main/pg_hba.conf (which lists permissions) and change:
local all all peer
to:
local all all trust
We may enjoy some initial data to start working with Abelujo: typical book categories, default places and basket(s), etc. They will be different depending on the user’s needs and language.
This command is required:
make db
In the next topic, see the available management commands.
Set the default datasource: if you want to search on the Swiss source by default, use a shell variable:
export DEFAULT_DATASOURCE='lelivre'
and then start Abelujo.
Set other variables in a configuration file.
Create a file config.py at the project root.
Make it start with the following line:
# -*- coding: utf-8 -*-
Abelujo will read the following variables at startup:
PAYMENT_CHOICES, for the sell page. For example:
(1, “ESPÈCES”), (7, “MAESTRO”), (10, “MASTERCARD”), (11, “VISA”), (12, “autre”), (100, “bon d’achat”),
]
(see models/common.py for the default ones)
Each entry must have a distinct id.
An id greater than 100 will not be counted in the total revenue of that day. It is typicall for coupons: you sold a coupon (bon d’achat) to a client last month, they use it today: you don’t want to count this sell twice.
In the database, each “CardType” represents a type of product: book, CD, newspaper, etc. You can associate a VAT to a product type directly in the admin panel.
That being said, if you have a lot of similar types, you can also choose a default VAT value:
VAT_TAXES = {
'default': 20,
}
Be sure to choose the VAT for the “book” type, and then you can use this setting.
The API token is used to protect the API endpoints.
In config.py set:
FEATURE_USE_API_TOKEN = True # False by default for backward compatibility of web clients purposes.
API_TOKEN = "secret"
Since January, 2021, Abelujo supports sending text messages (SMS) to clients, for example from the Reservations page. You need to create a Twilio account (https://www.twilio.com/) and configure 2 or 3 variables in config.py:
FEATURE_SMS = True
# twilio-python also searches for these tokens as env variables.
TWILIO_ACCOUNT = ""
TWILIO_TOKEN = ""
TWILIO_SENDER = "" # the sender phone number, to find in your Twilio account.
TWILIO_SENDER_NAME = "Librairie" # (optional). A custom sender name. Must alphanum, no spaces, at most 11 characters.
The Abelujo app should restart and you will see colored messages indicating that these settings were taken into account. You will also find new buttons in the Reservations page.