0

I've a site which is running perfectly in when DEBUG=True in settings.py but when I change DEBUG=False it stops serving the static files.

From settings.py

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static_dir"),
)
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

From urls.py

urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

From base.html

{% load staticfiles %}
<!-- Cerulean theme -->
<link rel="stylesheet" href="{% static 'bootstrap.min.css' %}">
HenryM
  • 5,557
  • 7
  • 49
  • 105

1 Answers1

0

You need an extra command when you deploy your project:

$ python manage.py collectstatic

Check docs.

Gocht
  • 9,924
  • 3
  • 42
  • 81