Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

need help, deployed to heroku but no styling/css...

I deployed my rails treebook app, and I'm getting just a basic html page showing, rather than the full thing I've been working on. Any thoughts anyone?

http://ancient-coast-2223.herokuapp.com/

9 Answers

Andrew Corcoran
Andrew Corcoran
20,552 Points

Nevermind, got it.

Ran bundle exec rake assets:precompile locally and then committed my code before pushing it up to Heroku.

Not sure if this mattered but I also amended my Gemfile to include rails_12factor as shown below, prior to committing.

group :production do
    gem 'pg'
    gem 'rails_12factor'    
end
Alan Johnson
Alan Johnson
7,625 Points

The deployed app is loading the stylesheets, but they're really simple. Are you sure that you've committed your latest work before you deployed it?

git add .
git commit -m "Your comment."
git push heroku master
Charles Massry
Charles Massry
12,253 Points

the way heroku manages the assets is weird it could be something in config/environments/production.rb, one of the config.assets.x might need to have its true/false value reversed.

It could be this, do you know which one? I've committed my work as I go along, and I had it working on my local server before I uploaded to heroku, its just the heroku-hosted version that's showing up weird

Not sure if there's a better way, but my production.rb code is below :)

Treebook::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

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = false

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

  # Generate digests for assets URLs
  config.assets.digest = true

  # Defaults to nil and saved in location specified by config.assets.prefix
  # config.assets.manifest = YOUR_PATH

  # 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

  # See everything in the log (default is :info)
  # 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"

  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  # config.assets.precompile += %w( search.js )

  # Disable delivery errors, bad email addresses will be ignored
  # config.action_mailer.raise_delivery_errors = false

  # Enable threaded mode
  # config.threadsafe!

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners
  config.active_support.deprecation = :notify

  # Log the query plan for queries taking more than this (works
  # with SQLite, MySQL, and PostgreSQL)
  # config.active_record.auto_explain_threshold_in_seconds = 0.5
end
Charles Massry
Charles Massry
12,253 Points

try setting config.assets.compile = false to true

This works perfectly!

tried changing config.assets.compile to true, still doesn't work :(.

It's weird, the site works and navigates as it should, its just the stylistic elements that arent showing up

Randy Wang
Randy Wang
9,291 Points

Hi Nicolas, I just completed the tutorial and deployed the site on Heroku but now have the exact same problem where the site seems to work fine but it has no styling. Have you figured out what the problem is here?

http://shrouded-sea-8608.herokuapp.com

Andrew Corcoran
Andrew Corcoran
20,552 Points

Also seeing this issue, I don't suppose anyone has figured it out?