
File Upload
FileField, ImageField, media files, file storage backends, custom storage, chunked uploads
1Which Django field should be used to store an uploaded file of any type?
Which Django field should be used to store an uploaded file of any type?
Câu trả lời
FileField is the standard field for storing any file type in Django. It automatically handles filesystem storage and saves the relative path in the database. This field requires configuring MEDIA_ROOT to define the physical storage directory.
2What is the main difference between FileField and ImageField?
What is the main difference between FileField and ImageField?
Câu trả lời
ImageField inherits from FileField and adds automatic validation to ensure the uploaded file is a valid image. It checks file headers and can extract image dimensions through width and height attributes. It requires the Pillow library to work.
3Which settings.py parameter defines the base directory for uploaded files?
Which settings.py parameter defines the base directory for uploaded files?
Câu trả lời
MEDIA_ROOT defines the absolute path to the directory where Django stores user-uploaded files. This parameter must point to a directory with write access for the application. MEDIA_URL defines the public URL to access these files.
Which HTML form attribute is required to allow file uploads?
How to access uploaded files in a Django view?
+17 câu hỏi phỏng vấn
Các chủ đề phỏng vấn Django khác
Python Basics
Python OOP
Django Fundamentals
Django Models - Basics
Django Views
Django Templates
Django Forms
Advanced QuerySets
Django Authentication
Django Middleware
Django Admin
Django REST Framework
Django Signals
Django Caching
Django Sessions
Django Email
Django Testing
Django Security
Django Deployment
Advanced Django ORM
Django Performance
Django & Celery
Django Channels
Django & GraphQL
Django & Docker
Django in Microservices Ecosystem
Custom Django Commands
Django Internationalization
Django Design Patterns
Django Async & ASGI
Settings & Production Configuration
Observability & Monitoring
Nắm vững Django cho lần phỏng vấn tiếp theo
Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.
Bắt đầu miễn phí