A
A
Anton2016-06-04 15:54:19
Ruby on Rails
Anton, 2016-06-04 15:54:19

Why is there a problem with resources in production?

In general, having understood what and how, I will describe the whole situation.
There is CloudFlare. He has enabled Development Mode in the domain settings. But CloudFlare is unlikely to affect anything at all here.
Move on.
If the project is run in development mode, then everything is fine. Recompiles the resource if it has been changed and the resource is successfully available at: site.ru/assets/application-md5-hash.css
If the project is run in production mode, then some nonsense comes out. I've been tinkering with this for hours now and seen some shit . About everything in more detail:

  1. I did rake assets:precompile, which in turn generated everything needed in the /public/assets directory. The file names and the hash in these names converge (the source code in the browser + what is on the server).
  2. On the site itself, all scripts and styles have an error, they say, 404 - there is nothing here. For example, for this style: site.ru/assets/application-md5-hash.css. If you prescribe public before assets, then it finds the style / script. But that doesn't solve the problem. There must be access to site.ru/assets/.
  3. After a long time, I began to find a resource, but only application.css, application.js and global.js. But besides them, there are also personal styles/scripts such as, for example, news.css/js or comments.css/js. They still get 404 errors.
  4. Next, I upgraded the assets.rb. Completed again rake assets:precompile. Everything returned to the starting point - all 404 errors. There is nothing.

I have touched absolutely nothing in production.rb. As it was generated during the creation of the project, it has been lying until today.
Moreover, I somehow, at the beginning of the creation of the project, launched the project in production mode. And all resources then were loaded without problems.
How the hell do I fix this?
Why such nonsense?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2016-06-04
@hummingbird

I'm not exactly sure, but...
I removed the assets directory to public and the option in production.rb:
Started working. That is, now it finds all the resources ...
Can this be regarded as a bug of the framework?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question