我使用Django 1.10 + uWsgi + nginx。在Prod模式下,静态文件不显示,这是我的nginx错误日志告诉我的:
404 ... static/CACHE/js/e3a6fa7588d1.js" failed (2: No such file or directory),
文件夹static/CACHE仍然是空的(所以404是合理的),但是为什么呢?我已经将权限设置为775 for static/CACHE。
nginx conf:
# /etc/nginx/sites/available/mysite_nginx.conf
# the upstream com
我有一个应用程序,我需要不断改变代码,样式和javascripts。它供管理员使用。因此,将其留在产品中作为开发模式会更容易-无需编译资源,在更新时重新启动服务器……
此外,我需要所有的代码和资产将在每个页面加载新鲜加载。而不在更新时编译。
问题来了。即使我将所有配置从/config/environments/development.rb复制到/config/environments/production.rb - On production Rails,Rails仍然会在/tmp/ dir中搜索编译后的资产。如何让它像在开发中那样使用资产?
server: nginx
rails versi
在Rails应用程序的config/application.rb文件中,有以下代码部分:
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundle
在Rails3中,专门用于在资产管道中生成资产的gem被正确地放置在gem文件的assets组中:
...
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
# See https://github.com/sstephenson/execjs#readme for mor