2020-02-27 13:43:54 +01:00
2021-01-12 15:09:48 +01:00
2020-02-27 09:43:16 +01:00
2020-10-09 12:34:28 +02:00
2020-03-03 11:20:28 +01:00
2020-02-27 09:43:16 +01:00
2020-03-03 11:20:28 +01:00

Photowall API 2

Provides a REST API to Photowall database.

Installation

Make sure that your system has Python version 3.6 installed.

Next its recommended that you create a virtualenv of python 3.6 and install all packages in it. To do that execute the following commands in your project folder:

$ virtualenv -p /usr/bin/python3.6 venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Local testing with docker

Make sure you edit docker-compose.yml with correct environment variables. This will launch the production image and listen on port 1881.

$ docker-compose  up --force-recreate --build -d

Documentation

Documentation is available here

Configuration

First copy config.sample.py to config.py. This file will be read by the application on startup.

List of available configuration options:

Name Description
SQLALCHEMY_DATABASE_URI Database connection string. e.g: postgresql://user:password@localhost/photowall
DEBUG Enable/disable debug mode
API_KEYS A list of api keys that are used to authenticate to the API. If this list is empty authentication will be disabled.
BERNARD_QUEUE_URL URL to Bernard queue (used for running Photowall background tasks)

Getting started

Starting the application:

$ python manage.py runserver

Release and development process

New branches are cut from master and when it is ready for test and code review a pull-request is created and the branch is deployed to the staging environment after checking that the staging environment is free to deploy to. A deploy to the staging environment is done using fab:

$ fab staging deploy

The staging branch is automatically synced from master on new commits to master.

Testing

To run unit tests:

$ python -m unittest

Performance testing with Locust

Run locally

$ pip install locust
$ USERNAME=user locust --host=http://localhost:1881
S
Description
No description provided
Readme
755 KiB
Languages
Python 91.2%
Makefile 8%
Shell 0.7%
Dockerfile 0.1%