-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
This guide provides step-by-step instructions to set up the SafeMinds AI project for local development. Follow these steps to get the application running on your machine.
Before you begin, ensure you have the following installed on your system:
- Operating System: Linux or macOS is recommended. Windows users should use the Windows Subsystem for Linux (WSL 2).
-
Python: Version 3.12.3 or later. Verify your installation includes
pip. [Download Python](https://www.python.org/) - Git: Required for cloning the project repository. [Install Git](https://git-scm.com/)
-
Virtual Environment Tool: Python's built-in
venvis used.
Optional: Depending on your OS and specific package installations (like OpenCV), you might need system-level build tools or libraries (e.g., build-essential, libgl1-mesa-glx on Debian/Ubuntu). Check pip install logs for errors if they occur.
git clone https://github.com/HackByte3-0/SafeMind-AI
cd SafeMind-AIWe use a virtual environment to isolate project dependencies.
# Create virtual environment
python -m venv venv
# Activate it:
# macOS/Linux:
source venv/bin/activate
# Windows (Git Bash/WSL):
source venv/Scripts/activate
# Windows (Command Prompt):
.\venv\Scripts\activate.bat
# Windows (PowerShell):
.\venv\Scripts\Activate.ps1
# Install dependencies
pip install -r requirements.txtWe use a .env file in development, loaded with python-dotenv.
cp env.example .envFill in the required environment variables:
# Django Settings
SECRET_KEY='your_unique_django_secret_key_here'
DEBUG=True
ALLOWED_HOSTS=127.0.0.1,localhost
# External API Keys
GEMINI_API_KEY='your_google_gemini_api_key_here'
CLOUDFLARE_ACCOUNT_ID='your_cloudflare_account_id_here'
CLOUDFLARE_API_TOKEN='your_cloudflare_api_token_here'Note: Never commit your .env file to Git.
- Purpose: Powers the AI chatbot using the Gemini Flash model.
-
Steps:
- Go to [Google AI Studio](https://aistudio.google.com/) or [Google Cloud Console](https://console.cloud.google.com/)
- Create/select a project.
- Enable the Generative Language API or Vertex AI API.
- Go to Credentials > Create API key.
- Copy and add to your
.envasGEMINI_API_KEY.
[Get API Key Guide](https://ai.google.dev/tutorials/get_started_web#get-api-key)
-
Purpose: Used for:
- Speech-to-text transcription.
- Sentiment analysis.
-
Steps:
- Login at [Cloudflare Dashboard](https://dash.cloudflare.com/)
- Get your Account ID (found in Overview or Workers section).
- Go to My Profile > API Tokens > Create Token.
- Use template or custom permissions:
-
Account→Workers AI→Read
-
- Scope the token to your account.
- Copy and add it to
.envasCLOUDFLARE_API_TOKEN.
For local dev, we use SQLite (auto-handled by Django).
# Apply DB migrations
python manage.py migrate
# Create a superuser for the admin panel
python manage.py createsuperuserpython manage.py runserverShould output something like:
Django version X.Y, using settings 'SafeMindsAI.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
- Admin Panel: Visit http://127.0.0.1:8000/admin/ and log in.
- Main App: Visit http://127.0.0.1:8000/ to check the app loads.
🎉 Done! You now have a local SafeMinds AI environment running. Let the building begin!