Skip to content

EMAM . Marathon 2024. PetWorld. API, Backend, User Auth. FastAPI. Python

Notifications You must be signed in to change notification settings

lexxai/EPAM-2024-petworld-python

Repository files navigation

Local setup guide


This guide should be used for local setup and testing only purposes. Don't use any credentials you might bump into in files like docker-compose.yml in production.

  1. Based on .env.template, create your own .env file and fill in all the possible entries. APP_CONFIG__DB__URL is mandatory to start the project and apply initial migrations.
  2. Run docker-compose up command and make every container is up-and-running
  3. Apply the latest migrations you have in alembic/versions folder. For this use alembic upgrade head command.
  4. Follow localhost:8000/docs to have a view of APIs available to do further dev testing

Homework

  1. Setup the project locally and make sure it's running without any issues
  2. Configure and implement logging functionality so that every request is logged into console and separate file named pet.log. This logging data should contain:
    • Request URL
    • Request method
    • Status code
    • Total time required to complete the request
  3. Additionally you could implement the same logging functionality, but using decorator approach, so that codebase is split to corresponding modules and looks concise.

Homework Solution

  1. .env moved to level of Docker env
  2. Configured logging_config logging_config example
  3. Logging HTTP request (middleware) middleware
  4. Log request alt text alt text Postman: alt text Log postman /me: alt text Decorator: alt text alt text

About

EMAM . Marathon 2024. PetWorld. API, Backend, User Auth. FastAPI. Python

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages