2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

開発環境、本番環境でのHTML、CSSの反映されないことについて

Posted at

Ruby2.2.5
rails4.2.6
Macosx
を使用
herokuにはデプロイ済み

Ruby on RailsでWEBシステムを開発中です。
Herokuにデプロイをし独自ドメインなどで試験運転をしてました。
不具合やレイアウト崩れがあったので、開発環境に切り替えて作業、はじめはrails sコマンドで反映されたのですが、どこかの設定やファイルをいじっくった為に全く、反映されなくなりました。

bundle exec rake assets:cleanやbundle exec rake tmp:cache:clear
rake assets:clobberを行っても意味がなく、開発環境ではapp/assets/stylesheets/application.cssだけの読み込みができません。
やはりlibやpuburicも読み込みに行ってます。
設定変更や、原因、何か良いアドバイスがあればよろしくお願いします!!

もうすこしでWEBサイトの運用が、スタート地点が見えて来た所で、足踏みをしてしまい悔しいです。。

こちらが開発環境のdevelopmentファイルです
Rails.application.configure do

Settings specified here will take precedence over those in config/application.rb.

In the development environment your application's code is reloaded on

every request. This slows down response time but is perfect for development

since you don't have to restart the web server when you make code changes.

config.cache_classes = false

Do not eager load code on boot.

config.eager_load = false

Show full error reports and disable caching.

config.consider_all_requests_local = true
config.action_controller.perform_caching = false

Don't care if the mailer can't send.

config.action_mailer.raise_delivery_errors = false

Print deprecation notices to the Rails logger.

config.active_support.deprecation = :log

Raise an error on page load if there are pending migrations.

config.active_record.migration_error = :page_load

Debug mode disables concatenation and preprocessing of assets.

This option may cause significant delays in view rendering with a large

number of complex assets.

config.assets.debug = true
config.assets.compile = false
config.assets.enabled = false

上記は開発環境時に必要な設定

Asset digests allow you to set far-future HTTP expiration dates on all assets,

yet still be able to expire them through the digest params.

config.assets.digest = false

Adds additional error checking when serving assets at runtime.

Checks for improperly declared sprockets dependencies.

Raises helpful error messages.

config.assets.raise_runtime_errors = true

Raises error for missing translations

config.action_view.raise_on_missing_translations = true

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => 'smtp.gmail.com',
:user_name => "///////l.com", #ご自身のgmailアドレス
:password => "///////////", #ご自身のgmailアドレスのパスワード
:authentication => 'login'
}

config.assets.prefix = "/dev-assets"

end

こちらが本番環境のproductionファイルです。

Rails.application.configure do

Settings specified here will take precedence over those in config/application.rb.

Code is not reloaded between requests.

config.cache_classes = true

Eager load code on boot. This eager loads most of Rails and

your application in memory, allowing both threaded web servers

and those relying on copy on write to perform better.

Rake tasks automatically ignore this option for performance.

config.eager_load = true

Full error reports are disabled and caching is turned on.

config.consider_all_requests_local = false
config.action_controller.perform_caching = true

config.cache_classes

config.action_controller.perform_caching

config.action_view.cache_template_loading = false

Enable Rack::Cache to put a simple HTTP cache in front of your application

Add rack-cache to your Gemfile before enabling this.

For large-scale production use, consider using a caching reverse proxy like

NGINX, varnish or squid.

config.action_dispatch.rack_cache = true

Disable serving static files from the /public folder by default since

Apache or NGINX already handles this.

config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?

Compress JavaScripts and CSS.

config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass

Do not fallback to assets pipeline if a precompiled asset is missed.

config.assets.compile = true

config.serve_static_files = true

Asset digests allow you to set far-future HTTP expiration dates on all assets,

yet still be able to expire them through the digest params.

config.assets.digest = true

config.assets.precompile and config.assets.version have moved to config/initializers/assets.rb

Specifies the header that your server uses for sending files.

config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache

config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.

config.force_ssl = true

Use the lowest log level to ensure availability of diagnostic information

when problems arise.

config.log_level = :debug

Prepend all log lines with the following tags.

config.log_tags = [ :subdomain, :uuid ]

Use a different logger for distributed setups.

config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

Use a different cache store in production.

config.cache_store = :mem_cache_store

Enable serving of images, stylesheets, and JavaScripts from an asset server.

config.action_controller.asset_host = 'http://assets.example.com'

Ignore bad email addresses and do not raise email delivery errors.

Set this to true and configure the email server for immediate delivery to raise delivery errors.

config.action_mailer.raise_delivery_errors = false

Enable locale fallbacks for I18n (makes lookups for any locale fall back to

the I18n.default_locale when a translation cannot be found).

config.i18n.fallbacks = true

Send deprecation notices to registered listeners.

config.active_support.deprecation = :notify

Use default logging formatter so that PID and timestamp are not suppressed.

config.log_formatter = ::Logger::Formatter.new

Do not dump schema after migrations.

config.active_record.dump_schema_after_migration = false

end

以下が直近のdeveropmentのlogです。

Started GET "/assets/icon_026430_256.png" for ::1 at 2016-11-13 12:27:03 +0900

ActionController::RoutingError (No route matches [GET] "/assets/icon_026430_256.png"):
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in call_app' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in block in call'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in block in tagged' vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in tagged'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in tagged' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in call'
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/runtime.rb:18:in call' vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in call' vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/sendfile.rb:113:in call' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/engine.rb:518:in call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/application.rb:165:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/content_length.rb:15:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/handler/webrick.rb:88:in service'
/Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/httpserver.rb:138:in service' /Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/httpserver.rb:94:in run'
/Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.3ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (11.7ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.4ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.5ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (144.6ms)

Started GET "/assets/ticket-navi.net.png" for ::1 at 2016-11-13 12:27:03 +0900

ActionController::RoutingError (No route matches [GET] "/assets/ticket-navi.net.png"):
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in call_app' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in block in call'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in block in tagged' vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in tagged'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in tagged' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in call'
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/runtime.rb:18:in call' vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in call' vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/sendfile.rb:113:in call' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/engine.rb:518:in call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/application.rb:165:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/content_length.rb:15:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/handler/webrick.rb:88:in service'
/Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/httpserver.rb:138:in service' /Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/httpserver.rb:94:in run'
/Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (26.8ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.3ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.4ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (156.8ms)

Started GET "/assets/favicon.ico" for ::1 at 2016-11-13 12:27:03 +0900

ActionController::RoutingError (No route matches [GET] "/assets/favicon.ico"):
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in call_app' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in block in call'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in block in tagged' vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in tagged'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in tagged' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in call'
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/runtime.rb:18:in call' vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in call' vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/sendfile.rb:113:in call' vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/engine.rb:518:in call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/application.rb:165:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/content_length.rb:15:in call' vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/handler/webrick.rb:88:in service'
/Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/httpserver.rb:138:in service' /Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/httpserver.rb:94:in run'
/Users/Apple/.rbenv/versions/2.2.5/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (10.9ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.4ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.8ms)
Rendered vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (134.4ms)

2
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?