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

228
Views
Archivos estáticos que no se cargan en el proyecto django

Tengo un proyecto en el que mi socio trabajó en la interfaz sin usar ningún marco, solo usó js, html y css. Quería adjuntar ese frente a la parte posterior usando Django.

Aquí están las configuraciones de settting.py

 STATIC_ROOT = os.path.join('C:/Users/1224095/work/Backend/backend/static') STATIC_URL = '/static/' STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', )

Agregué {% carga estática%} en mi encabezado html. Para no confundirlo, creé un directorio estático llamado static, y dentro obtuve mis activos y complementos de la interfaz, además, en cada lugar, agregué href= {% static 'path to the file' %} .

Como resultado, recibo un error de 404, ¿alguien tiene una idea de por qué? aquí hay un ejemplo de mi html:

 <!doctype html> <html lang="en"> {% load static %} <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="{% static 'assets/plugins/simplebar/css/simplebar.css' %}" rel="stylesheet" /> <link href="{% static 'assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css' %}" rel="stylesheet" /> <link href="{% static 'assets/plugins/metismenu/css/metisMenu.min.css' %}" rel="stylesheet" /> <link href="{% static 'assets/plugins/vectormap/jquery-jvectormap-2.0.2.css' %}" rel="stylesheet" /> <link href="{% static 'assets/plugins/highcharts/css/highcharts-white.css' %}" rel="stylesheet" />
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

(1): solo puede usar esto en su configuración.py -> STATIC_URL = '/static/'

(2): Tienes que copiar y pegar tus archivos estáticos (JavaScript, CSS, etc) en tus templates .

Se verá así:

 App |_migrations |_templates |_static |__App (directory with the App name) |_assets |_js |_css |_img |_plugins |_....

Tu HTML debería verse así:

 <!doctype html> <html lang="en"> {% load static %} <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="{% static 'App/assets/plugins/simplebar/css/simplebar.css' %}" rel="stylesheet" />

Simplemente no olvide escribir Aplicación antes de cada 'activo'

about 4 years ago · Juan Pablo Isaza Report
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!