Django Application

作者 aj-geddes3f5182cfd739無授權條款355 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

Develop production-grade Django applications with models, views, ORM queries, authentication, and admin interfaces. Use when building web applications, managing databases with Django ORM, and implementing authentication systems.

AI 產生的概覽

指導建置生產級 Django 網頁應用程式,涵蓋模型、檢視、ORM 查詢、驗證與管理後台。

功能
提供開發 Django 網頁應用程式的參考指南與最佳實務,涵蓋專案建置、以 ORM 進行模型設計、類別檢視與函式檢視、URL 路由、驗證與權限、資料庫查詢最佳化,以及管理後台客製化。內容包含快速開始的指令範例,以及一份該做與不該做的實務清單。此外還附帶一支結構描述驗證指令碼與一個遷移範本。
適用情境
適用於建立或擴充 Django 網頁應用程式、設計模型與資料庫結構、實作檢視與 URL 路由、建置驗證與權限系統、最佳化 ORM 查詢,或客製化 Django 管理後台的情境。
執行需求
需要已安裝 Django 的 Python 環境,以及所建置應用程式使用的資料庫後端。附帶一支可執行的驗證指令碼與一個遷移範本;未說明需要憑證或網路存取。

Django Application

Table of Contents

Overview

Build comprehensive Django web applications with proper model design, view hierarchies, database operations, user authentication, and admin functionality following Django conventions and best practices.

When to Use

  • Creating Django web applications
  • Designing models and database schemas
  • Implementing views and URL routing
  • Building authentication systems
  • Using Django ORM for database operations
  • Creating admin interfaces and dashboards

Quick Start

Minimal working example:

bash
django-admin startproject myprojectcd myprojectpython manage.py startapp userspython manage.py startapp products

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Django Project Setup [blocked]Django Project Setup
Model Design with ORM [blocked]Model Design with ORM
Views with Class-Based and Function-Based Approaches [blocked]Views with Class-Based and Function-Based Approaches
Authentication and Permissions [blocked]Authentication and Permissions
Database Queries and Optimization [blocked]Database Queries and Optimization
URL Routing [blocked]URL Routing
Admin Interface Customization [blocked]Admin Interface Customization

Best Practices

✅ DO

  • Use models for database operations
  • Implement proper indexes on frequently queried fields
  • Use select_related and prefetch_related for query optimization
  • Implement authentication and permissions
  • Use Django Forms for form validation
  • Cache expensive queries
  • Use management commands for batch operations
  • Implement logging for debugging
  • Use middleware for cross-cutting concerns
  • Validate user input

❌ DON'T

  • Use raw SQL without ORM
  • N+1 query problems without optimization
  • Store secrets in code
  • Trust user input directly
  • Override init in models unnecessarily
  • Make synchronous heavy operations in views
  • Use inheritance models unless necessary
  • Expose stack traces in production

來源與署名

來源:aj-geddes/useful-ai-prompts位於skills/django-application提交3f5182c

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架