How souhailbourhim/crm_app works
Project type and purpose
• This is a full-stack web application: a Django-based CRM (Customer Relationship Management) system called DCRM/CRM_APP.
• Its purpose is to manage customers and leads through secure authenticated CRUD operations, with a responsive Bootstrap UI and SQLite via Django ORM.
File structure
• Top-level:
• manage.py – Django CLI entry point
• DCRM/ – Django project settings (asgi.py, wsgi.py, settings.py, urls.py)
• CRM_app/ – Core Django app containing models, views, forms, admin, templates, migrations, tests
• mydb.py – custom database-related script (optional utility)
• CRM_app/templates/ – HTML templates broken out by page (home, add_record, update_record, etc.)
• Config files (settings.py) define database, middleware, installed apps, URL routing.
• Migrations folder manages DB schema changes.
README for additional insights
• Tech stack: Django (backend), Bootstrap/HTML/CSS/JS (frontend), SQLite (database).
• Authentication and role-based authorization use Django’s security framework.
• Mentions modular architecture and ORM usage.
Main components
a. External client layer
• Web Browser (User)
• HTTP(S)
b. Web server / application layer
• Django development server (or production WSGI/ASGI host)
• URL Router (DCRM/urls.py)
• Middleware (authentication, security)
c. Application logic layer (CRM_app)
• Views (CRM_app/views.py)
• Forms (CRM_app/forms.py)
• Models (CRM_app/models.py)
• Admin site (CRM_app/admin.py)
• Templates (CRM_app/templates/*.html)
d. Data layer
• SQLite database (db.sqlite3)
• Migration scripts (CRM_app/migrations/)
• Optional custom scripts (mydb.py)
e. Static assets (if present)
• CSS/JS (Bootstrap)
f. Testing & CI
• Tests (CRM_app/tests.py)
Relationships and interactions
• Browser → (HTTP request) → Django Server
• Django Server → URL Router → appropriate View
• View ↔ Form (input validation)
• View ↔ Model (ORM queries) → SQLite
• View → Template rendering → HTML response → Browser
• Admin module uses same Model layer to CRUD
• Migrations run offline to update schema
Architectural patterns & design principles
• MVC (Django is MTV: Model-Template-View)
• Layered architecture with clear separation: presentation (templates), business logic (views/forms), data access (models)
• Modular app structure (single “CRM_app” app—could split further by feature, e.g., leads/agents in the future)
• Use of built-in authentication middleware for security
Technologies and frameworks to annotate
• Django (with DCRM as project root)
• Django ORM → SQLite
• Bootstrap / HTML / CSS / JS for UI
• ASGI/WSGI interface
• Python 3 virtual environment
Essential details without overcomplicating
• Don’t try to show every single template or view file; group by function (e.g., “CRM_app Views”).
• Data flow: client requests → view logic → database → templating → client response.
• Authentication middleware and admin sub-system as distinct modules.