# pixelyoki/django-wsm architecture

> Architecture diagram of the GitHub repository pixelyoki/django-wsm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pixelyoki/django-wsm
- Repository: https://github.com/pixelyoki/django-wsm

## Overview

##### Project type and purpose
- This is a full‐stack web application built on the Python-Django framework.
- Purpose: A 商品库存交易管理系统 (Inventory & Order Management System) supporting user registration/login, profile management, staff CRUD, product CRUD, order CRUD, and message notifications.

##### File structure
- Top‐level files:
- manage.py – Django CLI entry point
- inventory_system/ – Django project settings, ASGI/WSGI, root URL conf
- dashboard/ & user/ – Two Django “apps” encapsulating domain logic
- db.sqlite3 – Development database
- requirements.txt – Python dependencies
- media/ – Uploaded user profile images
- templates/ – Jinja2‐style HTML templates, organized by app and shared partials
- Patterns/Architecture:
- MTV (Model-Template-View) pattern of Django
- Separated “user” app for authentication/profile and “dashboard” app for core inventory & order logic
- Static/media served separately from dynamic views
- Deployment hints (README mentions a cloud server URL) imply use of a web server (e.g., Nginx), an application server (Gunicorn/Uvicorn), and the database.

##### Key README insights
- Provides UI flows (screenshots of login, dashboard, CRUD pages)
- Lists core features: user management, staff management, product management, order management

## Diagram (Mermaid)

```mermaid
graph TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["Client Browser"]:::frontend
        StaticServer["Static Asset Server"]:::infra
        MediaStorage["Media Storage"]:::infra
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        Nginx["Nginx Reverse Proxy / Load Balancer"]:::infra
        Gunicorn["Gunicorn/Uvicorn App Server"]:::infra
    end

    %% Application Layer
    subgraph "Django Application"
        subgraph "Project Configuration"
            Settings["settings.py"]:::app
            URLs["urls.py"]:::app
            ASGI["asgi.py"]:::app
            WSGI["wsgi.py"]:::app
        end
        subgraph "User App"
            UserModels["user/models.py"]:::app
            UserViews["user/views.py"]:::app
            UserForms["user/forms.py"]:::app
            UserAdmin["user/admin.py"]:::app
            UserMigs["user/migrations/"]:::app
        end
        subgraph "Dashboard App"
            DashModels["dashboard/models.py"]:::app
            DashViews["dashboard/views.py"]:::app
            DashForms["dashboard/forms.py"]:::app
            DashURLs["dashboard/urls.py"]:::app
            DashAdmin["dashboard/admin.py"]:::app
            DashMigs["dashboard/migrations/"]:::app
        end
        subgraph "Templates"
            Partials["templates/partials/"]:::app
            UserTemps["templates/user/"]:::app
            DashTemps["templates/dashboard/"]:::app
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        ORM["Django ORM"]:::app
        Database["SQLite Database (db.sqlite3)"]:::data
        Cache["Redis Cache (optional)"]:::data
        EmailSvc["External Email/SMS Service"]:::data
    end

    %% Dev Tools
    subgraph "Development Tools"
        ManagePy["manage.py"]:::infra
        ReqTxt["requirements.txt"]:::infra
    end

    %% Media and Static details
    subgraph "Static Assets"
        CSS["static/css/"]:::infra
        JS["static/js/"]:::infra
        Fonts["static/fonts/"]:::infra
        Icons["static/icons/"]:::infra
        Images["static/img/"]:::infra
    end

    subgraph "Media Files"
        ProfileImgs["media/Profile_Images/"]:::infra
    end

    %% Relationships
    Browser -->|"HTTPS"| Nginx
    Nginx -->|"GET /static/*"| StaticServer
    Nginx -->|"GET /media/*"| MediaStorage
    Nginx -->|"Proxy dynamic requests"| Gunicorn
    Gunicorn -->|"WSGI/ASGI"| Settings
    Gunicorn -->|"WSGI/ASGI"| ASGI
    Gunicorn -->|"routes via"| URLs
    Gunicorn -->|"loads apps"| UserModels
    Gunicorn -->|"loads apps"| DashModels
    UserViews -->|"renders"| Partials
    UserViews -->|"renders"| UserTemps
    DashViews -->|"renders"| DashTemps
    UserViews -->|"queries"| ORM
    DashViews -->|"queries"| ORM
    ORM -->|"persists"| Database
    ORM -->|"caches"| Cache
    UserViews -->|"sends notifications"| EmailSvc

    StaticServer --> CSS
    StaticServer --> JS
    StaticServer --> Fonts
    StaticServer --> Icons
    StaticServer --> Images

    MediaStorage --> ProfileImgs

    ManagePy --> Settings
    ManagePy --> URLs
    ManagePy --> ASGI
    ManagePy --> WSGI
    ReqTxt --> Settings

    %% Click Events
    click ManagePy "https://github.com/pixelyoki/django-wsm/blob/main/manage.py"
    click Settings "https://github.com/pixelyoki/django-wsm/blob/main/inventory_system/settings.py"
    click URLs "https://github.com/pixelyoki/django-wsm/blob/main/inventory_system/urls.py"
    click ASGI "https://github.com/pixelyoki/django-wsm/blob/main/inventory_system/asgi.py"
    click WSGI "https://github.com/pixelyoki/django-wsm/blob/main/inventory_system/wsgi.py"
    click UserModels "https://github.com/pixelyoki/django-wsm/blob/main/user/models.py"
    click UserViews "https://github.com/pixelyoki/django-wsm/blob/main/user/views.py"
    click UserForms "https://github.com/pixelyoki/django-wsm/blob/main/user/forms.py"
    click UserAdmin "https://github.com/pixelyoki/django-wsm/blob/main/user/admin.py"
    click UserMigs "https://github.com/pixelyoki/django-wsm/tree/main/user/migrations/"
    click DashModels "https://github.com/pixelyoki/django-wsm/blob/main/dashboard/models.py"
    click DashViews "https://github.com/pixelyoki/django-wsm/blob/main/dashboard/views.py"
    click DashForms "https://github.com/pixelyoki/django-wsm/blob/main/dashboard/forms.py"
    click DashURLs "https://github.com/pixelyoki/django-wsm/blob/main/dashboard/urls.py"
    click DashAdmin "https://github.com/pixelyoki/django-wsm/blob/main/dashboard/admin.py"
    click DashMigs "https://github.com/pixelyoki/django-wsm/tree/main/dashboard/migrations/"
    click Partials "https://github.com/pixelyoki/django-wsm/tree/main/templates/partials/"
    click UserTemps "https://github.com/pixelyoki/django-wsm/tree/main/templates/user/"
    click DashTemps "https://github.com/pixelyoki/django-wsm/tree/main/templates/dashboard/"
    click CSS "https://github.com/pixelyoki/django-wsm/tree/main/static/css/"
    click JS "https://github.com/pixelyoki/django-wsm/tree/main/static/js/"
    click Fonts "https://github.com/pixelyoki/django-wsm/tree/main/static/fonts/"
    click Icons "https://github.com/pixelyoki/django-wsm/tree/main/static/icons/"
    click Images "https://github.com/pixelyoki/django-wsm/tree/main/static/img/"
    click ProfileImgs "https://github.com/pixelyoki/django-wsm/tree/main/media/Profile_Images/"
    click Database "https://github.com/pixelyoki/django-wsm/blob/main/db.sqlite3"
    click ReqTxt "https://github.com/pixelyoki/django-wsm/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#BBDEFB,stroke:#0D47A1,color:#0D47A1
    classDef app fill:#C8E6C9,stroke:#1B5E20,color:#1B5E20
    classDef data fill:#FFE082,stroke:#FF6F00,color:#FF6F00
    classDef infra fill:#EEEEEE,stroke:#616161,color:#424242
```
