Skip to content

signalstickers/backend

Repository files navigation

Backend for signalstickers

This Django app provides an API for signalstickers.org to use, as well as a control panel to manage packs.

⚠️ Do not open Pull Requests without asking before. ⚠️
I'm not looking for new features at the moment, as this is an "internal tool" for the moderation/admin team.

Dev

Install the pipenv (make venv), and open a pipenv shell (pipenv shell). You'll then be able to use signalstickers/manage.py (e.g. ./signalstickers/manage.py runserver).

Useful commands

  • Run tests: pipenv run test
  • Run lint: pipenv run lint
  • Run bandit: pipenv run sec
  • Run the 3 above: pipenv run check (run it before commiting, as this is run by Github)
  • Update requirements.txt: pipenv lock -r > requirements.txt

Docker

We use Docker containers for postgres. An adminer container is available to browse the DB from a web browser at http://localhost:9988 (with autologin).

Launch the containers

sudo docker-compose up -d

Stop containers

sudo docker-compose down

Reset containers

sudo docker-compose down                    # If needed
sudo rm -rf .pgdata                         # Remove the data directory of postgres
sudo docker-compose up --force-recreate -d  # Rebuild the containers and start them

Initializing a dev env

  1. Create an admin account: ./signalstickers/manage.py createsuperuser ;
  2. Import some stickers: copy/paste some stickers from the old YML format, save them in a file, and import them: ./signalstickers/manage.py import_from_yml path/to/file.yml . We recommend that you import only ~20, as this process is slow;
  3. Start the dev server with ./signalstickers/manage.py runserver ;
  4. Navigate to http://localhost:<PORT>/admin and log in.

Production

Copy signalstickers/settings/prod.py.dist to signalstickers/settings/prod.py and edit values.

Author

Romain RICARD contact+sstbackend at romainricard.fr

Releases

No releases published

Packages

No packages published