/homebytwo

You are going for an outdoor adventure! But will you be back on time?

Primary LanguagePythonMIT LicenseMIT

Homebytwo Build Status Coverage Status

This repository contains the Django source code for http://homebytwo.ch. Homebytwo is a hobby project to plan the schedule of hiking, running and cycling outings, in order to reliably tell what time I will be back.

It would be great if other young fathers with a similar motivation could contribute to the vision.

Installation Requirements

Vagrant >= 1.8.4
Git >= 1.0

You also need a virtualization solution, either one of these:

Virtualbox >= 4.3
LXC >= 1.0 & vagrant-lxc >= 1.0.0.alpha.2

Optional dependencies:

  • vagrant-hostmanager A Vagrant plugin that manages /etc/hosts files. (will be automatically used if installed, make sure it's at least 1.5.0 if you have it)

Installation

Clone the repository on your machine and open the project directory:

$ git clone --recursive https://github.com/HomebyTwo/homebytwo.git && cd homebytwo

Insall addition vagrant plugins:

$ vagrant plugin install vagrant-cachier vagrant-hostmanager

Create and provision the virtual machine:

$ vagrant up

Add the following setting files to the envdir folder containing the corresponding value for the environment variable:

Run the development server:

$ vagrant ssh
$ ./manage.py runserver

Open homebytwo in your browser:

http://local.homebytwo.ch

Create superuser

To create an initial user, you can user the create superuser function.

$ ./manage.py createsuperuser

Import Places from SwissNAMES3D or geonames.org

In order to find places along routes, homebytwo requires places in the database.

For Switzerland, places should be imported from SwissNAMES3D. The import of more than 300.000 places takes about 30 minutes:

$ ./manage.py import_swissnames3d_places

Thanks to geonames.org, you can also places from other countries:

$ ./manage.py import_geonames_places ES FR DE IT

Run Tests

$ vagrant ssh
$ tox

Add a requirement

Add the requirement to the requirements/xxx.in file, and then run make requirements (from inside the box) to update the .txt files and install the requirement(s) in the virtual environment.

Managing Celery

After changing a task code, you'll need to restart Celery for changes to be taken into account (Celery is run asynchronously because some processes take a really long time, including the signup process which would otherwise timeout). To restart celery, run:

sudo systemctl restart celery

To see the output of Celery tasks, use journalctl (-f is to follow the output):

sudo journalctl -u celery -f