Skip to content

Projeto-final-M5/api

Repository files navigation

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Recommended


Project Structure

.
├── venv                     - Python libs
├── _project                 - Global project settings
├── .github                  - Github Workflow Actions
├── addresses                - Model Address files
├── books                    - Model Book files
├── borroweds                - Model Borrowed files
├── extra_datas              - Model Extra_Data files
├── feed_back                - Model Feed_back files
├── genders                  - Model Gender files
├── pictures                 - Model Picture files
├── users                    - Model Users files
├── utils                    - Utils files
├── .coverage                - Coverage file
├── .coveragerc              - Tests coverage config file
├── .env                     - Environment variables
├── .env.example             - Environment variables example files
├── .gitignore               - Github ignore files config
├── docker-compose.yml       - Docker container config file
├── DockerFile               - Docker image config file
├── manage.py                - Django Utility file
├── requirements             - Dependencies file
└── README.md                - Readme file from projet

Installing


  • Clone repository
git clone [email protected]:Projeto-final-M5/api.git
  • Copy the environment variables
 cp .env.exemple .env
  • Write your environment variables
    POSTGRES_DB='YourDatabaseName'
    POSTGRES_USER='YourDatabaseUser'
    POSTGRES_PASSWORD='YourUserPassword'
    SECRET_KEY='SetYourSecretKey'
    DB_HOST="db"
  • Change DB_HOST to "127.0.0.1" if you want to run the project without docker

  • Access the Virtual Environment
source venv/bin/activate
  • If you are using windows you need to use the powershell and activate the Virtual Enviroment using this command
.\venv\Scripts\activate
  • Install dependencies
pip install -r requirements.txt
  • Run the Migrations
python manage.py migrate
  • Start application
python manage.py runserver

Installing with docker

  • Build application
docker compose up --build
  • Start application
docker compose up
  • Access application
http://localhost:8000/

Usage

Base URL

https://book-prod-api.herokuapp.com/

Documentation