/justo-agency

Challenge

Primary LanguagePython

Agency Justo's

Challenge.

Tech Stack

  • Django 3.2.3
  • Django Rest Framework
  • Python 3.9
  • Postgres 13.0
  • Virtualenv
  • Git
  • Github
  • Git Flow

Libraries

Tools

Documentation

ERD (Entity Relationship Diagram)

Logo

Run Locally

Create virtualenviroment

  virtualenv -p python3.9 .env

Activate virtualenviroment

  source .env/bin/activate

Clone the project

  https://github.com/IvanMSP/justo-agency.git

Install requirements from txt file

  pip install -r requirements/develop.txt

Create database on Postgres

    CREATE DATABASE database_name;

    # Create User
    CREATE USER user WITH PASSWORD 'passswordstrong';

    # Users settings
    ALTER ROLE user SET client_encoding TO 'utf8';
    ALTER ROLE user SET default_transaction_isolation TO 'read committed';
    ALTER ROLE user SET timezone TO 'UTC';

    # Grant priveliges
    GRANT ALL PRIVILEGES ON DATABASE database_name TO user;

Go to the project directory and create file .env for enviroments variables

   touch .env

   # Added the next variables:
   NAMEDB
   USERDB
   PASSWORDDB
   HOST
   PORT
   SECRET_KEY
   DEBUG
   SETTINGS_MODULE

Run Migrations

  python manage.py migrate

Create data initial for the project.

  python manage.py loaddata data_initial.json

Ready for run project

  python manage.py runserver

Pre-Commit

Precommit was configured with black and flake-8, respectively a code formatter and a linter, pre-commit checks your code every time you commit.

(.pre-commit-config.yaml)

repos:
-   repo: https://github.com/ambv/black
    rev: 20.8b1
    hooks:
    - id: black
      language_version: python3.9.1
-   repo: https://gitlab.com/pycqa/flake8
    rev: 3.9.0
    hooks:
    - id: flake8

# Optional hook. Check dependencies are safe
-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety
    rev: v1.2.1
    hooks:
    -   id: python-safety-dependencies-check

File configuration for Black and Flake8

  black.toml

  .flake8

Install pre-commit into project

pre-commit install

Next Steps

Deploy

Tools

  • Google Cloud Platform

  • VM with Debian SO

  • Cloud Storage for storage media files from project

  • VM with Postgres 13

  • Nginx

  • Supervisor

  • Gunicorn

Architecture

Architecture

Notes:

In learning process: CI Integration with Jenkins, for ease deploy. :)