An open source alternative to Movescount.
- Free and open-source software
- OpenStreetMap integration
- Strava import
- Plots with curve smoothing
- Python 3.5, 3.6 or 3.7
- virtualenv
- pip (package manager)
# cp openmoves.cfg.default openmoves.cfg
# virtualenv virtualenv
# source virtualenv/bin/activate
# pip install -r requirements.txt
# ./openmoves.py add-user -u <your_username> [-p <your_password]
Configurations and parameters of openmoves.cfg
Required:
- SQLALCHEMY_DATABASE_URI Database URL to be used
Optional:
- BING_MAPS_API_KEY Bing maps API key. If not configured the Bing maps layers are disabled. Get your own key at https://www.bingmapsportal.com
- STRAVA_CLIENT_ID The client ID of the Strava application (example:
12345
) - STRAVA_CLIENT_SECRET The client secret of the Strava application (example:
'ea01c8e942fd68a98d47ad96adb936a564089e2e'
)
Start a Postgres database which stores all data in ./postgres-data/
$ docker-compose up -d
Adjust the SQLALCHEMY_DATABASE_URI
in the openmoves.cfg
SQLALCHEMY_DATABASE_URI = 'postgresql://openmoves:openmoves@localhost:5432/openmoves'
Initialize the database schema
$ ./openmoves.py db upgrade
# ./openmoves.py runserver
* Running on http://127.0.0.1:5000/
Open http://127.0.0.1:5000/
in your browser.
We use py.test
to test server side code. Tests are executed with the following command given that your virtualenv is activated:
# py.test
If a test fails it might help to run in verbose mode and stop on the first failure:
# py.test -vsx
Note that the majority of unit tests write the latest HTML response to a local tempfile in /tmp/pytest-<your-username>/response.html
using py.test's tmpdir
mechansism.
JavaScript unit tests are written with QUnit and are not yet automated in the build and need to be run in a browser by browsing to:
Hints or pull requests how to automate the qunit tests are welcome.
We ship the openmoves.wsgi
script to deploy OpenMoves in a Apache HTTP server with mod_wsgi
.
Example configuration
<VirtualHost 127.0.0.1:80>
ServerAlias your.domain
ServerName your.domain
DocumentRoot /var/www/openmoves
AddDefaultCharset utf-8
WSGIDaemonProcess openmoves user=openmoves group=openmoves processes=1 threads=5 python-home=/var/www/openmoves/virtualenv python-path=/var/www/openmoves lang='en_US.UTF-8' locale='en_US.UTF-8'
WSGIScriptAlias / /var/www/openmoves/openmoves.wsgi
<Directory /var/www/openmoves>
WSGIProcessGroup openmoves
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ServerAdmin mail@your.domain
</VirtualHost>
While OpenMoves uses an on-disk SQLite database by default, we recommend to deploy OpenMoves on a proper database such as PostgreSQL.
First create a database and login role.
Then overwrite the openmoves default database url in the openmoves.cfg
file:
SQLALCHEMY_DATABASE_URI = 'postgresql://<user>:<password>@localhost:5432/<database>'
Then create/upgrade the database schema with:
# ./openmoves.py db upgrade
Create an initial user:
# ./openmoves.py add-user -u <your_username>