Backend Installation and Setup Guide¶
Welcome to the setup guide for the backend environment of the Trustworthy and Ethical Assurance (TEA) Platform. This guide will walk you through the necessary steps to get the backend up and running on your local machine. Whether you're setting up for development, testing, or preparing for production deployment, this guide covers installing Python and Django, initializing the database with SQLite for development, and configuring PostgreSQL for more robust environments.
Prerequisites¶
Before you begin setting up the backend, it's essential to have a proper Python environment management system in place. For this setup, we recommend using Anaconda or Miniconda, which are powerful platforms for managing Python environments and packages. Anaconda is a full-featured distribution that includes a wide range of scientific libraries and tools, making it ideal for data science and machine learning projects. Miniconda is a minimal installer for Anaconda, offering the same environment and package management capabilities but allowing you to install only the packages you need. Both options provide a convenient way to create isolated environments for different projects, ensuring dependencies are kept separate and do not conflict.
If you don't already have Anaconda or Miniconda installed, please visit their respective websites for installation instructions tailored to your operating system. This will streamline the process of creating a virtual environment and managing the necessary Python packages for the TEA Platform backend.
Setting Up the Backend¶
-
Clone the Repository
First, clone the Assurance Platform repository to your local machine using the following command:
This command copies all the necessary files to your local system.
-
Setting Up the Backend
Create and Activate a Virtual Environment
To avoid conflicts with other Python projects, create a virtual environment specifically for the TEA Platform backend. Using Conda, you can create a new environment with Python 3.8 as follows:
-
Install Dependencies
Navigate to the eap_backend directory within the cloned repository and install the required dependencies:
-
Initialize the Database
Use Django's built-in commands to set up the database. By default, this guide uses SQLite for simplicity and ease of use:
-
Run Tests
Ensure everything is set up correctly by running the Django test suite:
-
Launch the Backend Server
Start the Django development server. By default, the server will run on port 8000:
At this point, your backend should be running locally, accessible via http://localhost:8000/api. You can now proceed to set up the frontend to interact with the backend API.
Running Locally: After Changes¶
After making any updates to the database schema or if you're running the server for the first time, ensure to apply migrations:
Running the API Server¶
To start the API server, simply execute:
from the eap_backend
directory. The server will restart automatically upon code changes, making development efficient and streamlined.
Running Tests¶
It's good practice to run tests frequently during development. To execute the test suite, use:
Continue with Frontend Setup¶
This guide provides you with the foundation needed to develop and test the TEA Platform's backend. With the backend operational, you can focus on integrating with the frontend or expanding the platform's capabilities. >> Continue with frontend setup.