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 trialstevenvandervalk
2,866 Pointsproject files lead to Missing `secret_key_base` for 'development' environment, set this value in `config/secrets.yml`
Bah. Didn't know I had more text space when I wrote the first part.
Download project files, bundle, localhost produces this error. just fyi.
stevenvandervalk
2,866 PointsThanks for the reply, it turned out my YAML syntax was wrong as well as below.
David Axelrod
36,073 Pointssame!!
2 Answers
alborz
Full Stack JavaScript Techdegree Graduate 30,885 PointsIn case anyone else was wondering, the following solution helped me:
Create a secrets.yml file in your config directory.
In your terminal, type the following command:
rake secret
. This will generate a secret for you to include in your secrets.yml file.Add the following snippet of code to your config/secrets.yml file:
development:
secret_key_base: PASTE_YOUR_GENERATED_SECRET_HERE
(NOTE: WHEN TYPING THE ABOVE COMMAND, BE SURE TO ADD SPACES BEFORE "secret_key_base" AND NOT TABS, AS THIS WON'T WORK IN A YML FILE.)
Be sure to migrate your database: bin/rake db:migrate RAILS_ENV=development
Now when you boot up the server and render the application in the browser, you should be good to go.
Daniel Kouba
11,353 PointsThis worked for me. I was in the new Rails API course as well. Thanks!
David Axelrod
36,073 PointsThanks!
Steve Hunter
57,712 PointsThanks for this - worked fine for me! :-)
Jim Withington
12,025 PointsThis is happening in the new Rails API course for me as well!
One thing to keep in mind, of course: if you're using actual, real keys for something you're really building, you have to make sure that these secrets don't get posted in public Git repos, etc. For our purposes, though, I believe it will be all right.
Denis Nurboja
10,601 PointsDenis Nurboja
10,601 PointsHi,
you have to generate new secret. Use 'rake secret' task to generate new secret.