Skip to content

Falamarcao/assessment-plataforma-io

Repository files navigation



drawing

Pre assessment: Plataforma.io | Backend Python

DRF Web UI

This is my solution for the assessment presented HERE!

I hope you get fascinated or at least delighted.

Getting Started

Dependencies

  • Docker
  • Nginx (prod)
  • Gunicorn (prod)
  • PostgreSQL or possibly others SQL Databases
  • Python
  • Packages:
    • Django

Installing

Do you have Docker Installed?

NOTES About Both Enviroments - PROD & DEV

When web container start, on the first time, the follow commands are executed automatically:

    python manage.py flush --no-input
    python manage.py makemigrations
    python manage.py migrate --noinput
    python manage.py loaddata users.json posts.json reposts.json quote-postings.json

Getting ready the database and loading some example data, so NO NEED TO EXECUTE the commands ABOVE.
They are included on entrypoints scripts: entrypoint.sh and entrypoint.prod.sh.

But if wanted on your own risk it's possible to execute using:

docker-compose -f docker-compose.prod.yml exec web python manage.py flush --noinput
docker-compose -f docker-compose.prod.yml exec web python manage.py makemigrations
docker-compose -f docker-compose.prod.yml exec web python manage.py migrate --noinput
docker-compose -f docker-compose.prod.yml exec web python manage.py loaddata customers.json staff.json rooms.json events.json

INFO: we are not putting migrations on version control because this is a fresh start project.
Usually we put migrations on version control when we have a older project or a project where we expect to grow.

Building and Running Development environment (DEV)

  • BUILD

    docker-compose build --no-cache
    
  • RUN

    docker-compose up -d
    
  • STOP

    docker-compose down -v
    
  • SUPER USER & DJANGO ADMIN

    username: superuser
    password: password
    
    admin url: http://localhost:8000/admin
    

Building and Running production-ready environment (PROD)

  • If you have DEV running first take it down.

    docker-compose down -v
    
  • And then BUILD & RUN

    docker-compose -f docker-compose.prod.yml up -d --build
    
  • STOP

    docker-compose -f docker-compose.prod.yml down -v
    
  • USERS & DJANGO ADMIN

    username: superuser
    password: password
    
    username: staff
    password: password
    
    admin url: http://localhost:8000/admin
    

Automated Tests

On DEV Environment tests are executed on every container start see entrypoint.sh and a test.log file is generated,
to run on demand see the commands bellow:

  • DEV

    docker-compose exec web python manage.py test small_business.rooms small_business.events
    
  • PROD

    docker-compose -f docker-compose.prod.yml exec web python manage.py test small_business.rooms small_business.events
    

Help: If you have any problem please e-mail me or contact me on LinkedIn.

Common issue:

Use notepad++, go to edit -> EOL conversion -> change from CRLF to LF.

update: For VScode users: you can change CRLF to LF by clicking on CRLF present on lower right side in the status bar

https://stackoverflow.com/questions/51508150/standard-init-linux-go190-exec-user-process-caused-no-such-file-or-directory

Author: Marco Maschio

E-mail: [email protected]

Thank you for your time, and I hope we can talk in near future.

About

Pre assessment: Plataforma.io | Backend Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published