Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

262
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda