How to manage static files (e.g. images, js, css) {django}


Your project will probably also have static assets that aren’t tied to a particular app. In addition to using a static/ directory inside your apps, you can define a list of directories (STATICFILES_DIRS) in your settings file where Django will also look for static files. For example:
STATICFILES_DIRS = [
    BASE_DIR / "static",
    "/var/www/static/",
]

static()

docs.com

Helper function to return a URL pattern for serving files in debug mode:

이상한 코드를 보았다. https://github.com/ESTsoft-Book-Project/bookstore/blob/25379d55f885264568e12dd9d196658858a4fd86/core/urls.py#L23-L29

urlpatterns 뒤에 static()+ 연산으로 이어붙인 것 같은데, 이건 도대체 뭐냐?

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)