Skip to content

Project Folder Structure

Alexandar83 edited this page Feb 25, 2025 · 22 revisions

This page outlines the project folder structure, detailing core application code, configurations, utilities, and scripts with concise descriptions.

Table of Contents

  1. Project Root
  2. Application Code
  3. Configuration


1. Project Root

.dockerignore Specifies files and directories to be ignored by Docker.
.gitattributes Defines attributes for Git handling.
.gitignore Specifies files and directories to be ignored by Git.
manage.py Django management script for running server and commands.
poetry.lock Poetry dependency lock file.
pyproject.toml Poetry configuration file for dependencies and project setup.
README.md A brief project overview with key features and linksto the full
Wiki documentation.
requirements.txt List of Python dependencies.


2. Application Code

the_wall_api/ Main application logic for the The Wall API project.
 ├── tests/ Django test suite.
    └── test_views/ Test cases related to API views.
 ├── utils/ Contains shared utilities and architectural components.
    ├── concurrency_utils/ Tools for handling concurrency in simulations.
    ├── message_themes/ Predefined message templates for logs, responses,
and OpenAPI documentation.
    └── open_api_schema_utils/ Utilities for handling OpenAPI schema generation.

Toggle detailed file list

the_wall_api/

admin.py Django admin panel configuration for the API.
apps.py Django application configuration file.
models.py Defines database models used in the API.
serializers.py Serializers for converting data between formats.
tasks.py Celery task definitions for asynchronous processing.
urls.py API-specific router, defining endpoints for file uploads,
and cost and usage tracking.
views.py Manages API views for profiles and wall configuration,
handling authentication and request validation.
wall_construction.py Simulates wall construction, tracking material usage and costs
with sequential and concurrent execution.

the_wall_api/tests/
batch_tests_runner.py Runs test batches and aggregates results.
test_caching.py Tests for caching mechanisms.
test_celery_concurrent_tasks.py Tests for Celery concurrent task execution.
test_celery_sequential_tasks.py Tests for Celery sequential task execution.
test_djoser_integration.py Tests authentication and user management via Djoser.
test_locks.py Tests for PostgreSQL advisory locks and Redis-based locking mechanisms.
test_models.py Tests for Django models.
test_requests_flow.py Validation of the API requests lifecycle and processing logic.
test_serializers.py Validation of data serialization and deserialization logic.
test_throttling.py Validation of API rate limiting and request throttling.
test_urls.py Validates API URL routing and access control
for admin and documentation endpoints.
test_utils.py Provides utility functions and base classes to support the test suite.
test_wallconstruction.py Tests for wall construction logic and validation constraints.

the_wall_api/tests/test_views/
test_views/base_test_views.py Common setup and utilities for API view tests.
test_views/test_profiles_views.py Tests for the profiles API endpoints.
test_views/test_wallconfig_file_views.py Tests for the wall configuration files management API endpoints.

the_wall_api/utils/
api_utils.py Centralization of API endpoint paths, ensuring
consistent routing and accessibility across the project.
celery_task_utils.py Celery-specific logic for task processing.
custom_json_formatter.py Customizes JsonFormatter to rename output field names,
and ensure a desired field order.
env_utils.py Configures environment-based connection settings for
Redis, PostgreSQL, and Celery.
error_utils.py Formats exception messages for responses and error logging.
proxy_wall_creation.py Standalone wall construction simulation module.
storage_utils.py DB storage management, Redis cache handling,
and processing of uploaded wall configuration files.
wall_config_utils.py Wall configuration files validation and hash generation for
unique wall configuration identification.

the_wall_api/utils/concurrency_utils/
base_concurrency_utils.py Base class for concurrent wall construction,
defining shared logic for threading and multiprocessing.
multiprocessing_utils.py Implements a multiprocessing-based wall construction simulation
with inter-process communication and event synchronization.
threading_utils.py Provides a threading-based implementation of wall construction,
supporting both event and condition synchronization.

the_wall_api/utils/message_themes/
base.py Base class for message themes.
errors.py Standardized error message templates.
info.py Informational message templates.
success.py Success response message templates.
openapi.py Message templates specifically for OpenAPI documentation.

the_wall_api/utils/open_api_schema_utils/
auth_schema_extensions.py Custom OpenAPI authentication extension for DRF Spectacular,
modifying the token authentication schema.
djoser_utils.py Extends Djoser views to properly generate OpenAPI schema documentation.
open_api_examples.py Defines reusable OpenAPI examples for schema documentation.
open_api_parameters.py Externalizes OpenAPI query parameters for schema extension.
open_api_responses.py Defines reusable OpenAPI response schemas and examples
for standard API errors and success cases.
open_api_schemas.py Provides OpenAPI schema for the wall configuration
file upload interface in Swagger-UI.
request_serializers.py Defines request serializers for OpenAPI documentation.
response_serializers.py Defines response serializers for OpenAPI documentation.


3. Configuration

config/ Contains configuration files for Docker, environments,
scripts, and application settings.
 ├── docker/ Docker-related files for creating containerized environments.
 ├── envs/ Environment-specific configuration files.
    ├── common/ Common environment configurations.
    ├── dev/ Development environment configuration files.
    └── prod/ Production environment configuration files.
 ├── scripts/ Various utility and startup scripts.
    ├── common/ Common scripts shared across environments and platforms.
    ├── docker/ Docker-specific scripts.
    └── linux/ Linux-specific scripts.
 └── secrets/ Stores files used for Docker Swarm secrets management
(e.g., PostgreSQL and Redis credentials, and Django SECRET_KEY).

Toggle detailed file list

config/

asgi.py ASGI entry point for serving Django applications asynchronously.
celery.py Configures Celery with Django settings, manages task discovery,
and schedules periodic tasks.
settings.py Centralized configuration for Django, including DB, caching, API,
task processing, logging and settings
urls.py Main project router managing authentication, API documentation,
and linking to the_wall_api/urls.py.
wsgi.py WSGI entry point for serving Django applications synchronously.

config/docker/
Dockerfile.demo
Dockerfile.dev
Dockerfile.prod
Define environment-specific container configurations.
docker-compose-demo.yml
docker-compose-dev.yml
docker-compose-prod-v1.yml
docker-compose-prod-v2.yml
Multi-container setups orchestration for the different environments.

config/envs/
common/
redis.conf Base Redis configuration shared across all environments.
dev/
postgres_dev.env PostgreSQL credentials for the development environment.
the_wall_api_dev.env Environment variables for The Wall API in development.
prod/
django_secret_key_prod.env Django secret key for the prod v1 environment.
postgres_prod.env PostgreSQL credentials for the prod v1 environment.
redis_prod.env Redis credentials for the prod v1 environment.
the_wall_api_prod.env Environment variables for The Wall API in production.

config/scripts/
common/
poetry_shell.sh Cross-platform script to activate Poetry's virtual environment.
docker/
docker-compose-dev+migrations.sh Starts Docker services and applies database migrations.
start_celery_computation_worker.sh Launches a Celery worker with dynamic concurrency settings.
wait_for_celery_worker.py Ensures Celery workers are ready before starting Celery Beat.
wait_for_postgres.py Waits for PostgreSQL to be available before dependent services.
linux/
common_utils.sh Utility functions for environment variables and system tasks.
linux_install_prerequisites.sh Installs required dependencies for development.
refresh_allowed_hosts_wsl2.sh Updates ALLOWED_HOSTS with the current WSL2 IP
and outputs it to the terminal.

config/secrets/
Used in prod v2 environment
django_secret_key.txt Django secret key Docker Swarm secret.
postgres_db.txt DB name Docker Swarm secret for PostgreSQL.
postgres_password.txt DB password Docker Swarm secret for PostgreSQL.
postgres_user.txt DB user Docker Swarm secret for PostgreSQL.
redis_password.txt Redis password Docker Swarm secret.


Next:   DRF Configuration
Back to: System Overview

Return to Top
DTS Index
Home Page


Clone this wiki locally