Skip to content

Latest commit

 

History

History
96 lines (93 loc) · 2.53 KB

README.md

File metadata and controls

96 lines (93 loc) · 2.53 KB

TODO Backend

Local development setup

  1. Install pyenv
  2. Install the configured python version (3.12.7) using pyenv by running the command
    • For Mac/Linux
      pyenv install
      
    • For Windows
      pyenv install 3.12.7
      
  3. Create virtual environment by running the command
    • For Mac/Linux
      pyenv virtualenv 3.12.7 venv
      
    • For Windows
      python -m pip install virtualenv
      python -m virtualenv venv
      
  4. Activate the virtual environment by running the command
    • For Mac/Linux
      pyenv activate venv
      
    • For Windows
      .\venv\Scripts\activate
      
  5. Install the project dependencies by running the command
    python -m pip install -r requirements.txt
    
  6. Create a .env file in the root directory, and copy the content from the .env.example file to it
  7. Install docker and docker compose
  8. Start MongoDB using docker
    docker-compose up -d db
    
  9. Start the development server by running the command
    python manage.py runserver
    
  10. Go to http://127.0.0.1:8000/health/ API to make sure the server it up. You should see this response
    {
        "status": "UP",
        "components": {
            "db": {
                "status": "UP"
            }
        }
    }
    

To simply try out the app

  1. Install docker and docker compose
  2. Start Django application and MongoDB using docker
    docker-compose up -d
    
  3. Go to http://127.0.0.1:8000/health/ API to make sure the server it up. You should see this response
    {
    "status": "UP"
    }
    
  4. On making changes to code and saving, live reload will work in this case as well

Command reference

  1. To run the tests, run the following command
    python manage.py test
    
  2. To check test coverage, run the following command
    coverage run --source='.' manage.py test
    coverage report
    
  3. To run the formatter
    ruff format
    
  4. To run lint check
    ruff check
    
  5. To fix lint issues
    ruff check --fix