# Installation Guide for Digest Backend

Follow these steps to set up the Digest Backend project on your local machine.

## Cloning the Repository

1. Clone the repository:
    ```sh
    $ git clone https://github.com/WDI-Ideas/digest_backend.git
    $ cd digest_backend
    ```

## Setting Up the Environment

2. Install `virtualenv` if you haven't already:
    ```sh
    $ pip install virtualenv
    ```

3. Create a virtual environment:
    ```sh
    $ virtualenv venv
    ```

4. Activate the virtual environment:

   **Windows:**
   ```sh
   venv\Scripts\activate
    ```

    **Mac/Linux:**
    ```sh
    source venv/bin/activate
    ```

## Installing Dependencies

5. Install the required dependencies using pip:
    ```sh
    $ pip install -r requirements.txt
    ```

## Configuring the Environment Variables

6. Copy and rename the env.example file to .env and set all the required variables. Ensure there are no spaces around the =:
    ```sh
    $ cp env.example .env
    ```

## Migrating the Database

7. Run the following command to create the database tables:
    ```sh
    $ python manage.py migrate
    ```

## Pre-Populating the Database

8. Run the following command to pre-populate the database with custom command:
    ```sh
    $ python manage.py load_iam_fixture
    ```

## Running the Server

9. Run the following command to start the server:
    ```sh
    $ python manage.py runserver
    ```

Now, your server should be up and running. Access it in your browser at http://127.0.0.1:8000/.

## Note :
- Make sure you have Python and pip installed on your system.
- If you encounter any issues, ensure that all dependencies are properly installed and the environment variables are correctly configured.
- Always activate the virtual environment before running any Python or Django commands.
