Static files configuration Django project

Common problems with static files and how to configure extra folder.
For static files. See simple summary often used by us.

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

 vim settings.py

STATIC_JOBS = ("vacatures", "/home/sites/vacaturestoday/data/vacature/")

 vim urls.py

+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

 

urlpatterns = [
    path('admin/', admin.site.urls),
] +static(settings.STATIC_JOBS[0], document_root=settings.STATIC_JOBS[1])


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

 

 

 

 

Comments