私はDjango 1.10 + uWsgi + nginxを使用しています。 のProdモードでは静的ファイルは表示されません、これは私のnginxのエラー・ログが私に語ったものです:Django - 静的/ CACHEファイルが見つかりません
404 ... static/CACHE/js/e3a6fa7588d1.js" failed (2: No such file or directory),
フォルダstatic/CACHE
は(その404年代には理にかなって)空のままですが、なぜですか? 私は既にの許可をstatic/CACHE
に設定しました。
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
}
}
Djangoの設定はそう
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__) + "../../../")
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
が含まれている、なぜstatic/CACHE
に私のJS/CSSファイルではありませんか?
EDIT: はそれを解決:uwsgi_passは(別のウェブサイトであることを起こっ)間違った上流の位置を指した: uwsgi_pass adjango;
私は既に持っています。ファイルは '/ static'へのコピーですが、' static/CACHE'内の空のファイルを探しています。 – FeedTheWeb
これは 'django-compressor'ですか? – user73657
はい、そうです。ファイルを作成していないようです。 – FeedTheWeb