How eduardouio/django_base works
1. Overall shape
This is a Django 5.1 monolith organized as a single backend project under app/backend/src, with one primary domain app, accounts, and a shared support layer in common. The repo is opinionated around server-rendered pages first, with room to add DRF/JWT later.
2. Project entrypoints and routing
config/asgi.py, config/wsgi.py, and manage.py define the runtime entrypoints. config/urls.py is the top-level router that dispatches requests into app-level URL modules, mainly accounts/urls.py today.
3. Identity and account domain
The accounts app is the main functional subsystem. It owns the custom user model (models/CustomUserModel.py), user manager (managers/CustomUserManager.py), profile/edit forms, and the user-facing views for login, logout, profile, password change, and home.
4. Authentication flow
Authentication is email-based rather than username-based. common/EmailBackEndAuth.py supports that login model, while the custom user manager creates users and superusers with email as the identifier. The accounts views and forms sit on top of this identity layer.
5. Cross-cutting middleware
common/LicenseValidationMiddleware.py and common/LoggingMiddleware.py sit in the request pipeline. They are the main architectural cross-cuts: one enforces/monitors license validity, the other captures request/response logging centrally before the request reaches the views.
6. Shared base model and domain support
common/BaseModel.py is the reusable persistence base for shared concerns such as audit metadata and soft-delete behavior. accounts/models/Licence.py shows the project also has a dedicated model for license state, which is tied to the middleware and management commands.
7. Presentation layer
The current UI is Django-template based, not SPA-based. accounts/templates/base/base.html defines the shared shell, while page templates under templates/pages/ and templates/forms/ cover login, home, profile, and profile update screens. Styling is designed for rapid iteration with CDN-loaded Tailwind/DaisyUI in the template layer.
8. Operational commands
accounts/management/commands/monitor_license_validation.py and test_license_validation.py provide command-line operational hooks around the licensing subsystem. This suggests license checks are not only runtime middleware logic but also something the team can inspect and validate from the CLI.
9. Persistence and file storage
The repo is set up for a relational database backend, with development defaults oriented toward SQLite and an easy path to PostgreSQL. User profile images are stored under media/accounts/pictures, so uploads are part of the account lifecycle.
10. Logging and runtime artifacts
Runtime logs live under src/logs, which matches the logging middleware’s role. Static assets are collected under src/static, and uploaded media is kept separate under src/media, preserving the usual Django boundary between immutable assets and user-generated content.
11. Testing structure
Tests are organized by concern under src/tests: base utilities, common utilities, models, and per-view tests for the accounts app. This layout reflects the architecture: the app is primarily tested through its view layer and core model/support primitives, with Pytest as the test runner.
12. What is intentionally not yet wired
The README indicates readiness for DRF, JWT, Playwright, PDF/export tooling, and a future frontend integration, but those are mostly preparation points rather than active subsystems in the tree. For an architecture diagram, the live system is best shown as Django templates + custom auth + middleware + license/audit support, with API/SPA/reporting capabilities staged for later.
Main entry points: settings.py Settings · forms Forms · CustomUserModel.py User model · tests Tests
Components 25
Runtime
Django entrypoints and project routing
- manage.py · Django CLI entrypoint
app/backend/src/manage.py - ASGI · ASGI application bootstrap
app/backend/src/config/asgi.py - WSGI · WSGI application bootstrap
app/backend/src/config/wsgi.py - Router · Top-level request router
app/backend/src/config/urls.py - Settings · Project configuration and app wiring
app/backend/src/config/settings.py
Accounts
Primary identity and profile domain
- User model · Custom email-based user account
app/backend/src/accounts/models/CustomUserModel.py - User manager · Creates users and superusers
app/backend/src/accounts/managers/CustomUserManager.py - Licence · License state persisted in the app
app/backend/src/accounts/models/Licence.py - Home · Authenticated landing page
app/backend/src/accounts/views/HomeTempView.py - Login · Email login page and flow
app/backend/src/accounts/views/LoginTempView.py - Logout · Logout redirect flow
app/backend/src/accounts/views/LoguoutRedView.py - Profile · Profile display page
app/backend/src/accounts/views/ProfileTempView.py - Profile edit · Profile update workflow
app/backend/src/accounts/views/ProfileUpdtView.py - Password change · Password update workflow
app/backend/src/accounts/views/ChangePassUpdtView.py - Forms · Creation, edit, and password forms
app/backend/src/accounts/forms
Shared Core
Cross-cutting auth, middleware, and base model support
- Email auth · Email-based authentication backend
app/backend/src/common/EmailBackEndAuth.py - Base model · Shared persistence concerns
app/backend/src/common/BaseModel.py - License check · Enforces or monitors license validity
app/backend/src/common/LicenseValidationMiddleware.py - Request log · Central request and response logging
app/backend/src/common/LoggingMiddleware.py
Templates
Server-rendered UI shell and pages
- Base shell · Shared page layout
app/backend/src/accounts/templates/base/base.html - Pages · Login, home, and profile screens
app/backend/src/accounts/templates/pages - Profile form · Profile update form template
app/backend/src/accounts/templates/forms/profile_update.html
Operations
CLI hooks, logs, and tests
- License CLI · Operational commands for license validation
app/backend/src/accounts/management/commands - Logs · Application log output directory
app/backend/src/logs - Tests · View, model, and common test coverage
app/backend/src/tests
Connections 32
- manage.py → Settings: loads · Bootstraps Django using project settings
- manage.py → Router: routes · Drives project URL configuration
- ASGI → Settings: uses · ASGI bootstraps with project settings
- WSGI → Settings: uses · WSGI bootstraps with project settings
- Router → Login: dispatches · Top-level router sends requests into accounts views
- Router → Home: dispatches · Top-level router sends requests into accounts views
- Settings → Email auth: configures · Registers email authentication backend
- Settings → License check: enables · Adds license validation to the request pipeline
- Settings → Request log: enables · Adds centralized logging middleware
- Settings → User model: sets · Uses the custom user model as auth identity
- User manager → User model: creates · Factory for custom users and superusers
- Email auth → User model: authenticates · Checks credentials against email-based users
- License check → Licence: checks · Reads license state during requests
- License CLI → Licence: operates on · Command-line hooks inspect license validation state
- Base model → Licence: supports · Shared persistence base underlies domain models
- Base model → User model: supports · Shared persistence base underlies domain models
- Home → Base shell: renders · Uses shared shell for server-rendered pages
- Login → Pages: renders · Login page template
- Profile → Pages: renders · Profile page template
- Profile edit → Profile form: renders · Profile update form template
- Pages → Base shell: extends · Page templates build on the shared shell
- Profile form → Base shell: extends · Form templates build on the shared shell
- Forms → Profile edit: submits to · Forms back the profile update workflow
- Forms → Password change: submits to · Forms back the password change workflow
- Login → Forms: uses · Login flow is form-driven
- Profile edit → Forms: uses · Profile edit flow is form-driven
- Password change → Forms: uses · Password change flow is form-driven
- Request log → Logs: writes · Central request logging lands in runtime log files
- Tests → Home: covers · View tests validate the primary pages
- Tests → Login: covers · View tests validate the primary pages
- Tests → Profile: covers · View tests validate the primary pages
- Tests → User model: covers · Model tests validate core identity behavior