Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
Django 1.11 is not loading css files

I have the next configuration:

urls.py

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^manager/', include('manager.urls')),

    #Static pages
    url(r'^index', TemplateView.as_view(template_name='index.html'), name='index'),
    url(r'^', TemplateView.as_view(template_name='index.html'), name='index'),
    url(r'^contact', TemplateView.as_view(template_name='contact.html'), name='contact'),
    url(r'^services', TemplateView.as_view(template_name='services.html'), name='services'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

settings.py

import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'pf.app.pfs',
]

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "assets"),
    #'/var/www/static/',
]

I executed the command:

python manage.py collectstatic

And the files are generated, also I added a css file with a single rule but and executed the command again.

But, in the momento to add it to my html file

    <head>
        {% load static %}
<link rel="stylesheet" href="{% static 'css/style.css' %}" />
</head>

in the html I get:

<link rel="stylesheet" href="/static/css/style.css">

And in the terminal:

"GET /static/css/style.css HTTP/1.1" 404 1766

What I have wrong in my static files configuration?

enter image description here

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!