How sungbinlee/django-blog-service works
1. Overall shape
- This is a single Django project named blogservice with two main domain apps: blog and user.
- The app is server-rendered: views return HTML templates rather than exposing a separate API layer.
2. Request entry points
- blogservice/urls.py is the top-level router and delegates to app-specific URL modules.
- manage.py is the local execution entry for migrations and development startup.
- wsgi.py and asgi.py are present, but the README indicates production runs through Gunicorn behind Nginx.
3. Core domain split
- user owns account lifecycle: registration, login, profile update, email verification, and activation state.
- blog owns content lifecycle: posts, tags, images, comments, replies, likes, search, and view counts.
- This split is the main architectural boundary in the repository.
4. Data model layer
- Each app has its own models.py and migrations, so schema changes are app-scoped.
- user includes a custom user model with fields such as profile picture and active/inactive status.
- blog contains the post/comment/reply model family and related features like likes, tags, and image attachment.
- admin.py in both apps exposes those models to Django admin for back-office management.
5. Authentication and onboarding flow
- Registration starts in user/forms.py and user/views.py.
- After signup, the system sends an email verification link using Django email utilities and a tokenized URL.
- Verification toggles the user’s is_active state; only activated users can proceed to normal login.
- The README implies SMTP is used for outbound email, configured through environment-based settings.
6. Blog content flow
- Blog CRUD is handled in blog/views.py with forms in blog/forms.py.
- Users can create, update, delete, and view posts; posts support tags, search, images, and view counts.
- Detail pages also serve as the hub for comment and reply actions, so most interaction flows converge on post detail.
7. Interaction features
- Comments and nested replies are first-class entities, each with create/edit/delete paths.
- Likes are supported for both posts and comments, implying separate relationship/state updates on those models.
- Search is exposed as a blog function, and the README indicates search by title and tag.
8. Presentation layer
- Templates are organized by app: blog/templates/blog/* and user/templates/user/*.
- Shared site chrome lives in templates/base.html, with a custom 404.html and an index.html landing page.
- context_processors.py suggests some global template context is injected across pages.
9. Shared project utilities
- blogservice/views.py and blogservice/utils.py likely provide project-level pages/helpers that are not owned by a specific domain app.
- settings.py is responsible for environment-driven configuration, including secret keys and email settings.
- This is where runtime concerns like installed apps, authentication configuration, media/static behavior, and deployment settings are centralized.
10. Operational boundaries
- The repository assumes a classic Django deployment stack: browser → Nginx → Gunicorn → Django app → database.
- Email verification adds an external dependency on an SMTP provider.
- Image uploads imply a separate file/media storage boundary from the relational database.
- Because the app is template-driven, the backend and frontend are tightly coupled through Django’s server-side rendering path.
Main entry points: settings.py settings · blog/views.py blog views · user/views.py user views · urls.py root urls
Components 19
Project core
Django project configuration and entrypoints
- manage.py · Local command runner for Django management tasks
blogservice/manage.py - settings · Central Django settings and environment wiring
blogservice/blogservice/settings.py - root urls · Top-level URL dispatcher delegating to app routers
blogservice/blogservice/urls.py - site views · Project-level pages such as landing and error handling
blogservice/blogservice/views.py - utils · Shared project helpers used across the Django site
blogservice/blogservice/utils.py - wsgi/asgi · Deployment interfaces for sync and async servers
blogservice/blogservice/wsgi.py
Blog app
Content, discussion, and search domain
- blog urls · Blog app route definitions
blogservice/blog/urls.py - blog views · Post lifecycle, interaction, and search handlers
blogservice/blog/views.py - blog forms · Validation and submission forms for blog actions
blogservice/blog/forms.py - blog models · Posts, comments, replies, likes, tags, and images
blogservice/blog/models.py - blog admin · Django admin registration for blog models
blogservice/blog/admin.py
User app
Accounts, onboarding, and profile domain
- user urls · Account and onboarding route definitions
blogservice/user/urls.py - user views · Registration, login, verification, and profile handlers
blogservice/user/views.py - user forms · Validation and submission forms for account flows
blogservice/user/forms.py - user models · Custom user model and activation/profile fields
blogservice/user/models.py - user admin · Django admin registration for user models
blogservice/user/admin.py
Presentation
Shared and app-specific templates
- base templates · Shared site chrome, landing page, and 404 page
blogservice/templates/base.html - blog templates · Post list, detail, CRUD, and search pages
blogservice/blog/templates/blog/post_detail.html - user templates · Login, registration, verification, and profile pages
blogservice/user/templates/user/login.html
Connections 23
- manage.py → settings: loads settings · Management commands bootstrap the Django project configuration
- root urls → blog urls: routes to · Root router delegates blog requests to the blog app
- root urls → user urls: routes to · Root router delegates account requests to the user app
- root urls → site views: serves · Root project routes also expose shared site pages
- site views → base templates: renders · Project pages use the shared site shell
- blog urls → blog views: dispatches · Blog routes are implemented by blog view handlers
- blog views → blog forms: uses · Blog actions rely on forms for validation and submission
- blog views → blog models: reads/writes · Content operations persist to blog domain models
- blog views → blog templates: renders · Blog handlers return server-rendered templates
- blog models → blog admin: registered in · Blog models are exposed through Django admin
- user urls → user views: dispatches · Account routes are implemented by user view handlers
- user views → user forms: uses · Registration and profile flows rely on forms
- user views → user models: reads/writes · Authentication and verification update the custom user model
- user views → user templates: renders · Account flows return server-rendered templates
- user models → user admin: registered in · User models are exposed through Django admin
- blog templates → base templates: extends · Blog pages share the common base layout
- user templates → base templates: extends · User pages share the common base layout
- settings → root urls: configures · Settings wire the URL configuration and runtime behavior
- settings → blog models: configures · Settings provide app configuration and persistence context
- settings → user models: configures · Settings provide app configuration and persistence context
- settings → wsgi/asgi: serves · Deployment entrypoints load the configured Django project
- blog views → utils: uses · Blog behavior can rely on shared project helpers
- user views → utils: uses · Account flows can rely on shared project helpers