Abelujo development

Install

See the up to date instructions on Gitlab.

See the Makefile for all the targets.

Run the development server (local)

make run and open your browser on localhost:8000.

The default username is admin and the password admin (see management commands to create and delete superusers).

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.

Run in production (server)

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.

See also the fab start/stop/restart commands.

Debian specificity: name collision between node and nodejs

This is installed with make debian:

sudo apt-get install nodejs-legacy

Use the Postgresql database

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

Populate the DB with our initial data

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.

We wrote a command to help define these in the most simple text file, and create them in the database. The usage is:

./manage.py runscript add_objects --script-args=scripts/categories_fr.yaml

This tool isn’t considered finished, you are fully in your right to ask for a simpler command. For more info, ask and see the sources !

How to contribute to Abelujo (git, gitlab, workflow)

To help develop Abelujo (welcome !) you need some basics in Python and Git. Then you’ll have to find your way in Django. You can help with html, css and javascript too. And if you’re experienced with Docker, you’ll have some work !

We use git as a source control system. You’ll need to learn the basics (essentially what git commit, git pull, git push and git branch do). To understand how creating branches help with our workflow, see the Github Flow (just replace Github by Gitlab).

Allright ! Take your time, I’ll wait for you. The next step is easier, you’re going to create an account on Gitlab.com. Gitlab is a web-based Git repository manager. It also has an issue tracking system and a basic wiki. It’s like Github, but there’s an open-source version of it. The sources of Abejulo are hosted on Gitlab.com . So, go there and create an account. You don’t need one to grab the sources, but you need one to cooperate with us.

Indeed, the workflow is as follows: - you have your copy of Abelujo, forked from the original (so that is

nows where it comes from)
  • you work on your repository.
  • you regularly update your repository with the modifications of the original repository (you want to be up to date to avoid conflicts).
  • when you’re finished, you open a pull-request on Gitlab.
  • we discuss it, it is eventually merged.

Once you have an account, you need to fork Abelujo’s repository. With your fork, you’ll be able to (easily) suggest to us your new developments (through pull-requests). So, go on Abelujo’s repository and click your “fork” button.

Now you can pull the sources of yours Abelujo copy:

git clone git@gitlab.com:<your_user_name>/abelujo.git

Choose the ssh version of the link over the https one. With some configuration of ssh on your side, you won’t have to type your username and password every time.

Note

If we recall well (ping us if needed), you need to add your ssh public key to your gitlab account (profile settings -> ssh keys). This key is located at “~/.ssh/id_rsa.pub”. If it doesn’t exist, create it with “ssh-keygen rsa”. A passphrase isn’t compulsory.

You’re ready to work on your local copy of Abelujo. You can commit changes and push them to your gitlab repository. Hey, we are also working on it at the same time, so don’t forget to pull the changes once in a while, and to work in a branch distinct from master, this will be easier.

And when you want to suggest changes to the official repository, you press the button “Pull Request”. We’ll have a place to tchat about your changes, and when a maintainer feels like it’s ok, he or she will merge your changes. We can also give you the right to do so.