Coder Social home page Coder Social logo

rikusv / procurement-portal-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keep-the-receipts/procurement-portal-backend

0.0 0.0 0.0 282 KB

Backend for a portal for searching procurement records

License: MIT License

Dockerfile 1.36% JavaScript 0.06% SCSS 0.05% Shell 0.66% Python 94.98% HTML 2.90%

procurement-portal-backend's Introduction

codecov Build Status

Procurement portal backend

Project Layout

Django

Apps go in the project directory procurement_portal

Python

Dependencies are managed via pyproject.toml in the docker container.

Add and lock dependencies in a temporary container:

docker-compose run --rm web poetry add pkgname==1.2.3

Rebuild the image to contain the new dependencies:

docker-compose build web

Make sure to commit updates to Pipfile and Pipfile.lock to git

Development setup

On Linux, you probably want to set the environment variables USER_ID=$(id -u) and GROUP_ID=$(id -g) where you run docker-compose so that the container shares your UID and GID. This is important for the container to have permission to modify files owned by your host user (e.g. for python-black) and your host user to modify files created by the container (e.g. migrations).

If you will be developing on the django frontend

docker-compose run --rm web yarn
docker-compose run --rm web yarn dev
docker-compose run --rm web python manage.py collectstatic

To initialise and run the django app

docker-compose run --rm web bin/wait-for-postgres.sh
docker-compose run --rm web python manage.py migrate
docker-compose up

Demo data

You can seed the database with demo data using

docker-compose run --rm web python manage.py loaddata demodata

This installs a superuser with username admin and password password.

Resetting the development environment data

If you need to destroy and recreate your dev setup, e.g. if you've messed up your database data or want to switch to a branch with an incompatible database schema, you can destroy all volumes and recreate them by running the following, and running the above again:

docker-compose down --volumes

Running tests

Make sure you have prepared static files and have the db running and ready

docker-compose run --rm web yarn
docker-compose run --rm web yarn build
docker-compose run --rm web python manage.py collectstatic
docker-compose run --rm web bin/wait-for-postgres.sh

Each time you'd like to run tests

docker-compose run --rm web python manage.py test

Settings

Undefined settings result in exceptions at startup to let you know they are not configured properly. It's one this way so that the defaults don't accidentally let bad things happen like forgetting analytics or connecting to the prod DB in development.

Key Default Type Description
DATABASE_URL undefined String postgresql://user:password@hostname/dbname style URL
DJANGO_DEBUG_TOOLBAR False Boolean Set to True to enable the Django Debug toolbar NOT ON A PUBLIC SERVER!
DJANGO_SECRET_KEY undefined String Set this to something secret and unguessable in production. The security of your cookies and other crypto stuff in django depends on it.
TAG_MANAGER_CONTAINER_ID undefined String Google Tag Manager Container ID. Use this to set up Google Analytics.. Requried unless TAG_MANAGER_ENABLED is set to False
TAG_MANAGER_ENABLED True Boolean Use this to disable the Tag Manager snippets, e.g. in dev or sandbox.

procurement-portal-backend's People

Contributors

jbothma avatar tomaszkolek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.