Torniojaws / vortech-backend

Python 3 backend for the Vortech website.
https://vortechmusic.com
MIT License
0 stars 0 forks source link
flask python3 restful-api uwsgi-emperor vps

GitHub version Build Status Coverage Status

Vortech API

This is the production Rest API of https://www.vortechmusic.com on the new VPS. The frontend is in the repository: https://github.com/Torniojaws/vortech-front/

Stack

Install

The preferred method is to use the makefile, which runs a whole slew of Ansible playbooks.

  1. Install make: sudo apt get install make
  2. Create the file deploy/vault_password and add the project vault password there.
  3. Then in the project root, run make deploy-dev or make deploy-prod

You can also check the full manual steps from Install Instructions

Update

When updating an existing installation, use make update-prod

Running locally

In the actual server, the backend runs via uWSGI as a service. But locally you can/need to launch it manually:

  1. Start the server: make run
  2. Send a request, eg. GET http://localhost:5000/api/1.0/news/
  3. Create a new User through the register page http://localhost:5000/register
  4. To make the user an admin, run this into the DB: INSERT INTO UsersAccessMapping(UserID, UsersAccessLevelID) VALUES(1, 4); Replace the 1 with the actual Users.UserID you have locally. Should usually be 1.

Tests

You can run the tests with make test, or alternatively: python3 -m pytest tests/. If you want the coverage report when running manually, run it with: python3 -m pytest tests/ --cov=apps --cov-report term-missing

Versioning

The common major.minor.micro format is followed. major releases will be huge updates with potential breaking features. minor releases add new features that don't break anything. micro releases are usually small tweaks and little additions. Until the first production release, the project stays as 0.x.x. The first production release will be 1.0.0.