Ich benutze Django 1.10 + uWsgi + nginx. In Prod Modus der statischen Dateien nicht auftauchen, ist das, was mir meine nginx Fehler-Log sagt:Django - statische/CACHE-Dateien nicht gefunden
404 ... static/CACHE/js/e3a6fa7588d1.js" failed (2: No such file or directory),
Der Ordner static/CACHE
leer bleibt (so den Sinn der 404), aber warum? Ich habe die Berechtigungen bereits auf 775
für static/CACHE
festgelegt.
nginx conf:
# /etc/nginx/sites/available/mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream bdjango {
server unix:///tmp/mysite.sock; # for a file socket
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name dev.mysite.com; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 8M; # adjust to taste
# Django media
location /media {
alias /var/www/mysite/src/media; # your Django project's media files - amend as required
}
location /static {
alias /var/www/mysite/src/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location/{
uwsgi_pass adjango;
include /var/www/mysite/src/uwsgi_params; # the uwsgi_params file you installed
}
}
Einstellungen Django enthält
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__) + "../../../")
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
Also, warum meine js/css sind Dateien nicht in static/CACHE
?
EDIT: es gelöst: uwsgi_pass wurde an der falschen Stelle stromaufwärts zeigt (die eine andere Website zufällig): uwsgi_pass adjango;
habe ich schon. Die Dateien sind Kopien der '/ static', jedoch sucht sie nach den (verkleinerten) Dateien in' static/CACHE', die leer sind. – FeedTheWeb
Ist das "Django-Kompressor"? – user73657
Ja ist es. aber es scheint nicht die Dateien zu erstellen. – FeedTheWeb