Static Files
Static Files vs Media Files
Section titled “Static Files vs Media Files”Django แยกไฟล์เป็น 2 ประเภทหลักที่จัดการต่างกัน:
| Type | Description | Example | Who Creates |
|---|---|---|---|
| Static Files | ไฟล์ที่มากับ code | CSS, JS, images, fonts | Developer |
| Media Files | ไฟล์ที่ user upload | avatars, documents, photos | User |
ทำไมต้องแยก
Section titled “ทำไมต้องแยก”| Concern | Static Files | Media Files |
|---|---|---|
| Version Control | อยู่ใน git | ไม่อยู่ใน git |
| Cache | Cache นาน + hash | Cache สั้นกว่า |
| CDN | ใช้ CDN ได้เลย | อาจต้อง private |
| Update | Deploy ใหม่ | Runtime upload |
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google