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

431
Views
Django, sirviendo archivos estáticos con nGinx da error 404

No puedo servir archivos estáticos a través de nGinx y en su lugar obtengo 404. Puedo ver el error (que se muestra en error.log), simplemente no puedo ver cómo solucionarlo.

urls.py

 urlpatterns += patterns('', ( r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'static'} ))

configuración.py

 STATIC_ROOT = os.path.join(PROJECT_DIR, "staticfiles/") STATIC_URL = '/static/' DEBUG=False

(hizo un collectstatic y todos los archivos estáticos ahora están en 'staticfiles/')

configuración de nginx

 server { listen 80; server_name my_ip; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/project/project/project/staticfiles; } location / { include proxy_params; proxy_pass http://unix:/home/project/project/project.sock; } }

base.html

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

y este es el registro

registro de errores

 2017/04/09 10:57:40 [error] 4719#4719: *182 open() "/home/project/project/project/staticfiles/static/images/home-lock.png" failed (2: No such file or directory)

("static/" se agrega en la URL estática y no puedo ver por qué)

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Prueba esto

 location /static/ { alias /home/project/project/project/staticfiles; }
about 4 years ago · Santiago Trujillo 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!