{% extends "base.html" %} {% load i18n %} {% load staticfiles %} {% load wger_extras %} {% block title %}{% trans "Get the code" %}{% endblock %} {% block content %}
{% blocktrans %}Click here to download the last stable version. For installation instructions see below.{% endblocktrans %}
{% trans "download stable version:" %} 1.4
{% blocktrans %}In short, these are the steps needed for an installation on a linux or OS X machine, with python already installed. If you want to develop, see the sections below.{% endblocktrans %}
{% blocktrans %}I personally like installing my development
files on a virtualenv, it helps keep the system more or less clean and are very
easy to set up, but you can skip this step if you don't mind installing all
dependencies system-wide (in that case, install django and the other applications
with a sudo
).{% endblocktrans %}
$ sudo apt-get install python-virtualenv
$ sudo apt-get install python-dev
$ virtualenv python-django
$ source python-django/bin/activate
{% blocktrans %}Get the application from PyPI, initialise and start it.{% endblocktrans %}
$ pip install wger
$ wger
{% blocktrans %}The script will, on first run, create a configuration file and a SQLite database with a standard superuser:{% endblocktrans %}
{% blocktrans %}You can later simply call wger
again to start
the application.{% endblocktrans %}
wger --help
to see available options{% endblocktrans %}The code is hosted both on github and on bitbucket. If you are unfamiliar with mercurial or git, take a look at HG init or Pro Git. Both repositories are mantained in sync, so you should be able to work on either one (issues and pull requests are only collected in github).
github (GIT) »
the main repository. All work happens here
git clone https://github.com/rolandgeider/wger.git
bitbucket (HG) »
a mirror of the main repo
hg clone https://bitbucket.org/rolandgeider/wger
The file structure you get once you clone the repo should be self explaining:
The installation procedure is very similar to the one described above for the packaged version. The notes and infos there also apply, so read that section too. First, install all packages (note that you might need to install more packages if you want the thumbnailer to be able to read more image formats, consult the documentation for pillow for more details):
$ sudo apt-get install python-virtualenv
$ sudo apt-get install python-dev
$ virtualenv python-django
$ source python-django/bin/activate
$ pip install -r requirements.txt
Get the code, create a superuser and start the webserver:
$ git clone https://github.com/rolandgeider/wger.git
$ cd wger
$ python start.py
That's it. You can either start the server again with
start.py
or do it the django way with
python manage.py runserver
.
If you pull updates and there were database changes, you
can apply them with a simple python manage.py migrate --all
.
wger also implements a series of django commands that perform different management functions that are sometimes needed:
python manage.py ...
download-exercise-images
- synchronizes the exercise
images from wger.de to the local installation. Read its help text
as it could save the wrong image to the wrong exercise should different
IDs match.
extract-i18n
- extract strings from the database
that have to be inserted manually in the PO file when translating. These
include e.g. exercise categories.
delete-temp-users
- deletes all guest users older than 1 week.
You will probably want to run this regularly via a cron job.
email-remainders
- sends out email remainders for user that
need to create a new workout. Usually run via cron job.
submitted-exercises
- prints a list of user submitted
exercises
wger uses two settings files to configure django:
For other ways of contributing besides code, you might want to take a look at the contribute page
pep8 --max-line-length=100--exclude="urls.py,*migrations*" wger
If you want to host this with some other environment (apache, postgreSQL, etc.), you need to perform some steps manually. First, install the necessary packages and dependencies as described before.
wger is regularly tested with the following software versions:
Setup any database that Django supports. Then create a settings file and edit it as needed. There is another configuration file, settings_global.py that contains other global settings.
$ python extras/scripts/create_local_settings.py
Initialise the database, create a super user and load these fixtures:
$ python manage.py syncdb
$ python manage.py migrate core
$ python manage.py migrate --all
$ python manage.py loaddata licenses
$ python manage.py loaddata languages
$ python manage.py loaddata language_config
$ python manage.py loaddata days_of_week
$ python manage.py loaddata equipment
$ python manage.py loaddata muscles
$ python manage.py loaddata categories
$ python manage.py loaddata exercises
$ python manage.py loaddata ingredients
$ python manage.py loaddata weight_units
$ python manage.py loaddata ingredient_units
What you do next depends on the server you use and how you
want to serve the application (mod_wsgi, fastCGI). There is a sample wsgi.py
file in the wger folder, edit it and adapt it to your needs and make the server
serve it, e.g. per mod_wsgi. Consult in any case the
django
documentation on the topic.