Skip to content

Latest commit

 

History

History
66 lines (47 loc) · 1.8 KB

dev_apiserver.md

File metadata and controls

66 lines (47 loc) · 1.8 KB

API Server Development Setup

This guide assumes you are using Debian GNU/Linux 11 or Ubuntu 20.04 LTS. If you aren't, just spin up a VM with the correct version. Support is unavailable for other operating systems.

Install Dependencies

$ sudo apt update
$ sudo apt install build-essential python3 python3-dev libffi-dev python3-pip python3-virtualenv memcached git

Clone the repo. Skip this step if you already have it:

$ git clone https://github.com/Protospace/spaceport.git

Set up Python:

$ cd spaceport/apiserver/
$ python3 -m virtualenv -p python3 env
$ source env/bin/activate
(env) $ pip install -r requirements.txt

You need to make sure the Python virtual environment (env) is enabled whenever you run the API server.

Copy the secrets file and optionally fill out values depending on which [[integrations]] you wish to enable. It runs fine by default.

(env) $ cp apiserver/secrets.py.example apiserver/secrets.py
(env) $ sensible-editor apiserver/secrets.py  # optional

Initialize Database

Set up the database:

(env) $ python manage.py makemigrations
(env) $ python manage.py makemigrations api
(env) $ python manage.py migrate

Generate static web files:

(env) $ python manage.py collectstatic

Running

Run the development server:

$ source env/bin/activate
(env) $ DEBUG=true BINDALL=true python manage.py runserver 0.0.0.0:8000

The development server is now listening on port 8000. You can connect to it by opening http://<ip address>:8000/ in your web browser. If it's running locally, that would be http://127.0.0.1:8000/.