0

I'm struggling to load my custom.css file to use in my bootstrap template:

error:

"GET /static/artdb/css/custom.css HTTP/1.1" 404 1785

path to custom.css:

static/artdb/css/custom.css

base.html:

{% load static %}
       :
<!-- Custom styles for this template --> 
<link rel="stylesheet" href="{% static "artdb/css/custom.css" %}">

urls.py:

urlpatterns = [
    path('artdb/', include('artdb.urls')),
    path('admin/', admin.site.urls),
]+static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

settings.py:

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

any idea what's wrong?

1
  • You need STATICFILES_DIRS settings in development environment. Commented Oct 1, 2018 at 12:07

1 Answer 1

1

settings.py:

STATIC_URL = '/static/'
STATIC_ROOT= os.path.join(os.path.dirname(BASE_DIR),'static')
STATICFILES_DIRS= [os.path.join(BASE_DIR,'###path to static folder in project###'),STATIC_URL]
Sign up to request clarification or add additional context in comments.

1 Comment

ok, STATICFILES_DIRS= [os.path.join(BASE_DIR,'static'),STATIC_URL] did it. thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.