Local Sightseeing Map
Backend and deployment source from a collaborative application for nearby-place discovery.
Django · Django REST Framework · MongoDB · JWT · Docker
backend/sightseeing_map/settings.py
import os
from pathlib import Path
from decouple import Config, Csv, RepositoryEnv
from datetime import timedelta # This is for the JWT token expiration time
# from pymongo import MongoClient #this is mongo
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
from dotenv import load_dotenv #i'm having problems getting in env
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
env_path = BASE_DIR / '.env'
config = Config(RepositoryEnv(env_path))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('DJANGO_SECRET_KEY') # config(): get the value of the key from the .env file. Config() is the class itself
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DJANGO_DEBUG', default=False, cast=bool)
ALLOWED_HOSTS = config('DJANGO_ALLOWED_HOSTS', default='localhost', cast=Csv())
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'rest_framework_simplejwt',
'corsheaders',
'users',
'drf_yasg',
'rest_framework_simplejwt.token_blacklist', # Invalidates tokens (e.g., after logout)
'api_keys',
'map',
]
CORS_ALLOW_CREDENTIALS = config('CORS_ALLOW_CREDENTIALS', default=True, cast=bool)
CORS_ALLOW_HEADERS = [
'content-type',
'x-api-key',
] # Update by adding to env template when needed
CORS_ALLOWED_ORIGINS = config('CORS_ALLOWED_ORIGINS', default='http://localhost:3000', cast=Csv())
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'sightseeing_map.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'sightseeing_map.wsgi.application'
# Database: See .env.template for the database configuration
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
load_dotenv() #try to load from env
MONGO_URI = os.getenv("MONGO_URI")
client = MongoClient(MONGO_URI)
MONGO_DB = client["sightseeing_maps"] #database_name
# Password validation
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = config('DJANGO_TIME_ZONE', default='UTC')
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# REST Framework settings
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
), # This is to make sure that all endpoints are protected by default
}
# Simple JWT settings
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=5),
"REFRESH_TOKEN_LIFETIME": timedelta(days=1),
"AUTH_HEADER_TYPES": ("Bearer",),
"ROTATE_REFRESH_TOKENS": True,
"BLACKLIST_AFTER_ROTATION": True,
"SIGNING_KEY": SECRET_KEY,
"ALGORITHM": "HS256",
}
# Email settings
EMAIL_BACKEND = config('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend')
EMAIL_HOST = config('DJANGO_EMAIL_HOST', default='localhost')
EMAIL_PORT = config('DJANGO_EMAIL_PORT', default=587, cast=int)
EMAIL_USE_TLS = config('DJANGO_EMAIL_USE_TLS', default=True, cast=bool)
EMAIL_USE_SSL = config('DJANGO_EMAIL_USE_SSL', default=False, cast=bool)
EMAIL_HOST_USER = config('DJANGO_EMAIL_HOST_USER', default='')
EMAIL_HOST_PASSWORD = config('DJANGO_EMAIL_HOST_PASSWORD', default='')
DEFAULT_FROM_EMAIL = config('DJANGO_DEFAULT_FROM_EMAIL', default='webmaster@localhost')
# Frontend URL
FRONTEND_URL = config('FRONTEND_URL', default='http://localhost:3000')
backend/sightseeing_map/urls.py
"""
URL configuration for sightseeing_map project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include, re_path
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
# Swagger and Redoc documentation
schema_view = get_schema_view(
openapi.Info(
title="Sightseeing Map API",
default_version='v1',
description="API documentation for the Sightseeing Map project, which provides users with sightseeing locations and user authentication.",
terms_of_service="https://example.com/policies/terms/", # To be updated
contact=openapi.Contact(email="[email protected]"), # To be updated
license=openapi.License(name="Propietary"), # To be updated
),
public=True,
permission_classes=(permissions.AllowAny,),
)
# URL patterns
urlpatterns = [
path('admin/', admin.site.urls),
path('sightseeing/v1/', include('api_keys.urls')), # Include the api_keys app
path('sightseeing/v1/', include('users.urls')), # Include the users app
path('sightseeing/v1/places/', include('map.urls')),
re_path(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'), # Keep This Three
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), # Lines While drf-yasg
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), # Is in used.
]
# Using the following URL pattern:
# {subdomain}.{domain}/{project-name}/{version}/{resource}/{action}/{id}
backend/map/views.py
from django.shortcuts import render
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
from .mongoDBhelper import create_location, delete_location, get_locations, update_location
@api_view(["GET"])
def list_locations(request):
return Response({"locations": get_locations()})
# spots = get_locations()
# return HttpResponse(dumps({"spots": spots}), content_type="application/json") #default one and i've seen others use this
@api_view(["POST"])
def add_location(request):
required_fields = ["name", "lng", "lat", "category", "img"]
missing_fields = [field for field in required_fields if field not in request.data]
if missing_fields:
return Response({"error": f"Missing required fields: {', '.join(missing_fields)}"}, status=status.HTTP_400_BAD_REQUEST)
location_id = create_location(request.data)
return Response({"message": "Location added", "id": str(location_id)})
@api_view(["PUT"])
def edit_location(request):
name = request.data.get("name")
new_data = {
"name": request.data.get("new_name"),
"lng": request.data.get("lng"),
"lat": request.data.get("lat"),
"category": request.data.get("category"),
"img": request.data.get("img"),
}
new_data = {key: value for key, value in new_data.items() if value is not None}
if not new_data:
return Response({"error": "No valid fields provided to update"}, status=400)
modified_count = update_location(name, new_data)
if modified_count == 0:
return Response({"error": "No matching location found or no update performed"}, status=404)
return Response({"message": "Location updated", "modified": modified_count})
@api_view(["DELETE"])
def del_location(request):
name = request.data.get("name") #id or name
deleted_count = delete_location(name)
return Response({"message": "Deleted successfully", "deleted": deleted_count})
backend/map/mongoDBhelper.py
from django.conf import settings
db = settings.MONGO_DB
spotsDB = db["spots"] #collection_name in mySQL or SQL they call it a table
def get_locations():
return list(spotsDB.find({}, {"_id": 0}))
def create_location(data): #we'll add validations here
return spotsDB.insert_one(data).inserted_id
def update_location(name, new_data):
return spotsDB.update_one({"name": name}, {"$set": new_data}).modified_count
def delete_location(name):
return spotsDB.delete_one({"name":name}).deleted_count
#we'll try basic CRUD operation first
#usersDB helper not yet done
usersDB = db["users"]
def createUser(data):
return usersDB.insert_one(data).insert_id
# def updateUser(name, new_data):
backend/api_keys/models.py
from django.db import models
import uuid
class APIKey(models.Model):
key = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
name = models.CharField(max_length=100, help_text='A name for the API key owner')
created_at = models.DateTimeField(auto_now_add=True)
is_active = models.BooleanField(default=True)
def __str__(self):
return f"{self.name} - {self.key}"
backend/api_keys/permissions.py
from rest_framework.permissions import BasePermission
from rest_framework.exceptions import APIException
from django.core.exceptions import ValidationError
from .models import APIKey
# For debugging purposes I have added a few custom exceptions. - AEM
class InvalidAPIKeyFormatError(APIException):
status_code = 403
default_detail = "The provided API key has an invalid format."
default_code = "invalid_api_key_format"
class MissingAPIKeyError(APIException):
status_code = 403
default_detail = "No API key provided in the request headers."
default_code = "missing_api_key"
class InvalidOrInactiveAPIKeyError(APIException):
status_code = 403
default_detail = "The provided API key is invalid or inactive."
default_code = "invalid_or_inactive_api_key"
class HasValidAPIKey(BasePermission):
"""
Custom permission to check for a valid API key in the request headers.
"""
def has_permission(self, request, view):
# Get the API key from the headers
api_key = request.headers.get('X-API-KEY')
# Raise an exception if the API key is missing
if not api_key:
raise MissingAPIKeyError()
try:
# Check if the key exists and is active
key = APIKey.objects.get(key=api_key, is_active=True)
return True
except ValidationError:
# Raise an exception if the API key format is invalid
raise InvalidAPIKeyFormatError()
except APIKey.DoesNotExist:
# Raise an exception if the key does not exist or is inactive
raise InvalidOrInactiveAPIKeyError()
backend/api_keys/serializers.py
from rest_framework import serializers
from .models import APIKey
class APIKeySerializer(serializers.ModelSerializer):
class Meta:
model = APIKey
fields = ['id', 'key', 'name', 'created_at', 'is_active']
backend/api_keys/views.py
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework.permissions import IsAdminUser
from .models import APIKey
from .serializers import APIKeySerializer
# Create new API key
class APIKeyCreate(APIView):
'''
Create a new API key: Only Admins/Backend users can create a new API key
Do not use in frontend applications
'''
permission_classes = [IsAdminUser]
def post(self, request): # The `request` object carries the data submitted by the client.
serializer = APIKeySerializer(data=request.data)
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
# List all API keys
class APIKeyList(APIView):
'''
List all API keys: Only Admins/Backend users can list all API keys
Do not use in frontend applications
'''
permission_classes = [IsAdminUser]
# The `request` object is required for permission checks and context, even if not explicitly used.
def get(self, request):
keys = APIKey.objects.all()
serializer = APIKeySerializer(keys, many=True) # many=True because we are serializing multiple objects
return Response(serializer.data, status=status.HTTP_200_OK)
# Retrieve or deactivate an API key
class APIKeyDetail(APIView):
'''
Retrieve or deactivate an API key: Only Admins/Backend users can retrieve or deactivate an API key
Do not use in frontend applications
'''
permission_classes = [IsAdminUser]
# The `request` object ensures proper authentication and permissions.
def get(self, request, key):
try:
api_key = APIKey.objects.get(key=key)
serializer = APIKeySerializer(api_key)
return Response(serializer.data, status=status.HTTP_200_OK)
except APIKey.DoesNotExist:
return Response({"error": "API key not found"}, status=status.HTTP_404_NOT_FOUND)
# The `request` object is needed for permissions and context.
def delete(self, request, key):
try:
api_key = APIKey.objects.get(key=key)
api_key.delete()
return Response({"message": "API key deleted"}, status=status.HTTP_204_NO_CONTENT)
except APIKey.DoesNotExist:
return Response({"error": "API key not found"}, status=status.HTTP_404_NOT_FOUND)
backend/users/models.py
from django.db import models
# Create your models here.
class PasswordReset(models.Model):
email = models.EmailField(max_length=255)
token = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.email
backend/users/serializers.py
from rest_framework import serializers
from django.contrib.auth.models import User
from rest_framework_simplejwt.tokens import RefreshToken
from django.contrib.auth.tokens import default_token_generator # Token generator for password reset
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode # Encode and decode uid
from django.utils.encoding import force_bytes
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.conf import settings
# User Serializer
class UserSerializer(serializers.ModelSerializer):
class Meta: # Meta class is used to specify the model and fields that we want to serialize
model = User
fields = ('id', 'username', 'email')
# Register Serializer
class RegisterSerializer(serializers.ModelSerializer):
password = serializers.CharField(write_only=True)
class Meta:
model = User
fields = ('id', 'username', 'email', 'password')
def create(self, validated_data):
user = User.objects.create_user(
validated_data['username'],
validated_data['email'],
validated_data['password']
)
return user
# Login Serializer
class LoginSerializer(serializers.Serializer):
username = serializers.CharField()
password = serializers.CharField(write_only=True)
token = serializers.SerializerMethodField()
def validate(self, data):
from django.contrib.auth import authenticate
user = authenticate(username=data['username'], password=data['password'])
if user:
refresh = RefreshToken.for_user(user)
return {
'username': user.username,
'token': {
'refresh': str(refresh), # Refresh token
'access': str(refresh.access_token), # Access token
}
}
raise serializers.ValidationError('Incorrect Credentials')
# Forgot Password Request Serializer
class PasswordResetSerializer(serializers.Serializer):
email = serializers.EmailField()
def validate_email(self, value):
# Try fetching user without revealing existence
try:
user = User.objects.get(email=value)
except User.DoesNotExist:
raise serializers.ValidationError("If the email exists, a password link will be sent to the email provided.")
self.context['user'] = user
return value
def save(self):
user = self.context['user']
token = default_token_generator.make_token(user)
uid = urlsafe_base64_encode(force_bytes(user.pk))
reset_link = f"{settings.FRONTEND_URL}confirm-reset-password/{uid}/{token}"
email_subject = "Password Reset Request"
email_body = render_to_string('emails/password_reset_email.html', {
'reset_link': reset_link,
'user': user,
})
# Using EmailMultiAlternatives to send HTML email
email = EmailMultiAlternatives(
subject=email_subject,
body=email_body,
from_email=settings.DEFAULT_FROM_EMAIL,
to=[user.email],
)
email.attach_alternative(email_body, "text/html")
email.send(fail_silently=False)
# Confirm Password Reset Serializer
class PasswordResetConfirmSerializer(serializers.Serializer):
uid = serializers.CharField()
token = serializers.CharField()
new_password = serializers.CharField(write_only=True)
def validate(self, data):
try:
uid = urlsafe_base64_decode(data['uid']).decode()
user = User.objects.get(pk=uid) # Get user by primary key
except (ValueError, User.DoesNotExist):
raise serializers.ValidationError("Invalid user")
if not default_token_generator.check_token(user, data['token']):
raise serializers.ValidationError("Invalid or expired token")
self.context['user'] = user
return data
def save(self):
user = self.context['user']
user.set_password(self.validated_data['new_password'])
user.save()
backend/users/views.py
from json import dumps
from rest_framework import generics, permissions, status # Used to enhance the views
from rest_framework.response import Response
from rest_framework.views import APIView
from .serializers import RegisterSerializer, LoginSerializer, UserSerializer, PasswordResetSerializer, PasswordResetConfirmSerializer
from django.contrib.auth.models import User
from rest_framework_simplejwt.views import TokenRefreshView
from rest_framework_simplejwt.tokens import RefreshToken
from rest_framework_simplejwt.exceptions import TokenError
from api_keys.permissions import HasValidAPIKey
# Register API
class RegisterAPI(generics.CreateAPIView):
'''
Register a new user
'''
serializer_class = RegisterSerializer
permission_classes = [HasValidAPIKey]
# Login API
class LoginAPI(APIView):
'''
Login a user
'''
# Temporarily allow access without API key to get the token
permission_classes = [permissions.AllowAny] # Uncomment this line to allow access without API key
# permission_classes = [HasValidAPIKey] # Allow any user to login, # Uncomment this line to bring back security
def post(self, request):
serializer = LoginSerializer(data=request.data)
if serializer.is_valid():
return Response(serializer.validated_data, status=status.HTTP_200_OK)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
# User API
class UserAPI(generics.RetrieveAPIView):
'''
Get a user
'''
permission_classes = [HasValidAPIKey, permissions.IsAuthenticated] # Only authenticated users can get a user
serializer_class = UserSerializer
def get_object(self):
return self.request.user
# Logout API
class LogoutAPI(APIView):
'''
Logout a user by blacklisting the refresh token
This endpoint includes a simple error logging mechanism to log token-related errors
For debugging purposes and can be removed or kept as needed
'''
permission_classes = [HasValidAPIKey, permissions.IsAuthenticated] # Only authenticated users can logout
def post(self, request):
try:
# Extract the refresh token from the request
refresh_token = request.data.get("refresh")
if not refresh_token:
return Response({"error": "Refresh token is required"}, status=status.HTTP_400_BAD_REQUEST)
# Blacklist the token
token = RefreshToken(refresh_token)
token.blacklist()
# 205: Reset Content status code -> a request has been successfully processed and the client should reset the document view
return Response({"message": "Successfully logged out"}, status=status.HTTP_205_RESET_CONTENT)
except TokenError as e:
# Log errors for debugging
if "Token is blacklisted" in str(e):
print(f"Attempted reused of blacklisted token: {refresh_token}")
return Response({"message": "Logout failed"}, status=status.HTTP_400_BAD_REQUEST)
except Exception:
return Response({"message": "Logout failed"}, status=status.HTTP_400_BAD_REQUEST)
# Password Reset Request API
class PasswordResetRequestAPI(APIView):
'''
Forgot password API Request
'''
permission_classes = [HasValidAPIKey, permissions.AllowAny] # Allow any user to request a password reset
def post(self, request):
serializer = PasswordResetSerializer(data=request.data)
if serializer.is_valid():
serializer.save()
return Response({"message": "If the email exists, a password link will be send to the email provided."}, status=status.HTTP_200_OK)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
# Password Reset API Confirmation
class PasswordResetConfirmAPI(APIView):
'''
Password Reset Confirmation API
'''
permission_classes = [HasValidAPIKey]
def post(self, request):
serializer = PasswordResetConfirmSerializer(data=request.data)
if serializer.is_valid():
serializer.save()
return Response({"message": "Password has been reset succesfully."}, status=status.HTTP_200_OK)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
backend/utils.py
from pymongo import MongoClient
def get_db_handle(db_name, host, port, username, password):
client = MongoClient(host=host, port=int(port), username=username, password=password)
db_handle = client['db_name']
return db_handle, client
backend/requirements.txt
asgiref==3.8.1
Django==5.1.4
django-cors-headers==4.6.0
django-filter==24.3
djangorestframework==3.15.2
djangorestframework-simplejwt==5.3.1
drf-yasg==1.21.8
gunicorn==23.0.0
inflection==0.5.1
Markdown==3.7
packaging==24.2
PyJWT==2.10.1
python-decouple==3.8
pytz==2024.2
PyYAML==6.0.2
sqlparse==0.5.2
uritemplate==4.1.1
backend/Dockerfile
# Use official Python image
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set work directory
WORKDIR /app
# Install Python dependencies
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Copy project files
COPY . /app
# Expose Django port
EXPOSE 8000
# Default command to run Django app
CMD ["gunicorn", "sightseeing_map.wsgi:application", "--bind", "0.0.0.0:8000"]
docker-compose.yml
version: '3.8'
services:
sightseeing_map:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "${DJANGO_PORT:-8024}:8000"
volumes:
- ./backend:/sightseeing-map
- sightseeing_map_static_volume:/sightseeing-map/static
env_file:
- .env
restart: unless-stopped
networks:
- hubstation_frontend_network
nginx:
image: nginx:1.21-alpine
ports:
- "${NGINX_PORT:-8080}:80"
volumes:
- ./nginx-config/api.astromao.com.conf:/etc/nginx/conf.d/api.astromao.com.conf:ro
- sightseeing_map_static_volume:/sightseeing-map/static
depends_on:
- sightseeing_map
restart: unless-stopped
networks:
- hubstation_frontend_network
volumes:
sightseeing_map_static_volume:
driver: local
networks:
hubstation_frontend_network:
external: true
scripts/deploy.sh
#!/bin/bash
# Script for full deployment process
set -e # Exit immediately if a command fails
echo "Step 1: Rebuilding Docker containers..."
./scripts/rebuild_docker.sh
echo "Step 2: Collecting static files..."
./scripts/collect_static.sh
echo "Deployment completed successfully."
scripts/initialize_environment.sh
#!/bin/bash
# Script to initialize the environment
set -e # Exit immediately if a command fails
echo "Starting Docker containers..."
docker-compose up -d --build
echo "Environment initialized successfully."