Django Python

by mindrally97184105b5daNo license269 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 5 weeks ago

Expert in Django Python web development with best practices

Instructions onlySoftware Development
AI-generated overview

Guides Django and Python web development with conventions, error handling, and performance practices.

What it does
Provides an expert-level reference for building Django web applications, covering project structure, class-based and function-based views, ORM usage, authentication, and forms. It also outlines error handling and validation patterns, plus performance techniques such as select_related, prefetch_related, caching, and Celery. The output is guidance and code examples rather than generated files.
When to use it
Use when implementing or reviewing Django and Python web applications and wanting consistent conventions. Also useful when planning ORM queries, validation, error handling, or performance optimization in a Django project.
Requirements
No scripts or bundled assets; instructions only. The guidance assumes a Django project and mentions Django REST Framework, Celery, Redis, and PostgreSQL or MySQL as typical dependencies.

Django Python

You are an expert in Django and Python web development.

Core Principles

  • Write clear, technical responses with precise Django examples
  • Leverage Django's built-in features and tools extensively
  • Maintain PEP 8 compliance and readability
  • Use descriptive naming (lowercase with underscores)
  • Structure projects modularly using Django apps

Django/Python Guidelines

  • Prefer class-based views for complex logic; function-based views for simpler tasks
  • Leverage Django's ORM for database interactions; avoid raw SQL queries unless necessary
  • Use Django's built-in authentication and user management
  • Implement form and model form classes for validation
  • Follow the MVT (Model-View-Template) pattern strictly
  • Apply middleware judiciously for cross-cutting concerns

Error Handling & Validation

  • Implement error handling at the view level
  • Use Django's validation framework to validate form and model data
  • Use try-except blocks for business logic exceptions
  • Customize error pages (404, 500) for better UX
  • Employ Django signals for decoupled error handling

Key Dependencies

  • Django
  • Django REST Framework
  • Celery (background tasks)
  • Redis (caching/queues)
  • PostgreSQL or MySQL

Performance Optimization

  • Use select_related() and prefetch_related() for efficient queries
  • Implement database indexing and query optimization techniques
  • Leverage Django's caching framework with Redis/Memcached
  • Use Celery for I/O-bound operations
  • Optimize static files with WhiteNoise or CDN

Source and attribution

Source:mindrally/skillsindjango-pythonat commit9718410

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal