개발 중 Static 파일 제공
- If you use django.contrib.staticfiles as explained above, runserver will do this automatically when DEBUG is set to True.
- If you don’t have django.contrib.staticfiles in INSTALLED_APPS, you can still manually serve static files using the django.views.static.serve() view.
- This is not suitable for production use.
- For example, if your STATIC_URL is defined as static/, you can do this by adding the following snippet to your urls.py:
from django.conf import settings from django.conf.urls.static import static urlpatterns = [ # ... the rest of your URLconf goes here ... ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
'Web 개발 > Django' 카테고리의 다른 글
QuerySet API (쿼리셋 API) (0) | 2024.03.25 |
---|---|
Django의 values() vs values_list() (0) | 2024.03.25 |
Django urlpatterns 함수: path, re_path, include, register_converter, static (0) | 2024.03.20 |
Django (0) | 2024.03.18 |