title: NameError: uninitialized constant Dotenv while pushing rails app to heroku
body: <p>I'm using dotenv to store environment variables and ever since I include it in the gemfile I cannot push it to heroku. I'm getting the following error:-</p>
  
  <pre><code>remote: -----&gt; Installing node-v6.10.0-linux-x64
  remote: -----&gt; Detecting rake tasks
  remote: sh: 2: Syntax error: Unterminated quoted string
  remote: sh: 2: Syntax error: Unterminated quoted string
  remote:  !
  remote:  !     Could not detect rake tasks
  remote:  !     ensure you can run `$ bundle exec rake -P` against your app
  remote:  !     and using the production group of your Gemfile.
  remote:  !     rake aborted!
  remote:  !     NameError: uninitialized constant Dotenv
  remote:  !     /tmp/build_5437bc300afb80cfa46b1111bb960f46/config/application.rb:17:in `&lt;top (required)&gt;'
  remote:  !     /tmp/build_5437bc300afb80cfa46b1111bb960f46/Rakefile:4:in `require_relative'
  remote:  !     /tmp/build_5437bc300afb80cfa46b1111bb960f46/Rakefile:4:in `&lt;top (required)&gt;'
  </code></pre>
  
  <p>This is how I'm including dotenv in my gemfile:-</p>
  
  <pre><code>gem 'dotenv-rails', :require =&gt; 'dotenv/rails-now'
  </code></pre>
  
  <p>I have tried adding the following in the application.rb file as well:-</p>
  
  <pre><code>Bundler.require(*Rails.groups)
  
  Dotenv::Railtie.load
  
  HOSTNAME = ENV['HOSTNAME']
  </code></pre>
  
  <p>still doesn't work.</p>
  
  <p>I don't know if those two lines that say "unterminated quoted string" could be some unrelated issue leading to the dotenv not loading. I looked it up and checked heroku config to see if there was something amiss in the variables but they all seem fine. I was able to push before I added the dotenv to gemfile. </p>
  
  <p>I tried running bundle install, restarting server, deleting gemfile.lock and running bundle install and I looked this issue up on here and tried solutions suggested in <a href="https://stackoverflow.com/questions/41036144/cant-push-to-heroku-because-of-dotenv-uninitialized-constant-error">Can&#39;t push to Heroku because of DOTENV uninitialized constant error</a></p>
  
  <p>Still no luck.</p>
  
  <p>PS - I'm trying to implement recaptcha and it is suggested best practice to use dotenv to store the site_key and secret_key for recaptcha as env vars. Hence I'm trying to get this to work.</p>