[英]Missing `secret_token` and `secret_key_base` for 'production' environment
I see all answers for this solution but no worked for me. 我看到了这个解决方案的所有答案,但没有为我工作。
1 - My configuration deploy is equal this tutorial by DigitalOcean (Capistrano 3 , Nginx, and Puma), with deploy success, i have error in my web: 1 - 我的配置部署与DigitalOcean (Capistrano 3 ,Nginx和Puma)的本教程相同,部署成功,我的网页出错:
An unhandled lowlevel error occurred.
发生了未处理的低级错误。 The application logs may have details.
应用程序日志可能包含详细信息
In log: 在日志中:
Rack app error: #< RuntimeError: Missing
secret_token
andsecret_key_base
for 'production' environment, set these values inconfig/secrets.yml
>机架应用程序错误:#<RuntimeError:缺少'生产'环境的
secret_token
和secret_key_base
,请在config/secrets.yml
secret_key_base
中设置这些值>
2 - In my droplet or VPN, I created variable with a key ( rake secret
) in file ./bashrc
2 - 在我的
./bashrc
或VPN中,我使用文件./bashrc
的密钥( rake secret
)创建了变量
export SECRET_KEY_BASE=XXXXXX
The file /config/secrets.yml
is default 文件
/config/secrets.yml
是默认的
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
With this env variable, i checked than this worked ( echo $SECRET_KEY_BASE
or printenv | grep SECRET_KEY_BASE
) 有了这个env变量,我检查了比这个工作(
echo $SECRET_KEY_BASE
或printenv | grep SECRET_KEY_BASE
)
3 - After Puma and Nginx is restarted and this error not is solved, i not know what is best way to check or debug this error. 3 - 重新启动Puma和Nginx并且此错误未解决后,我不知道检查或调试此错误的最佳方法是什么。
Does this tutorial does not work with this solution? 本教程不适用于此解决方案吗?
This is the proper way of handing capistrano env of rails using dotenv-rails gem . 这是使用dotenv-rails gem处理rails的capistrano env的正确方法。 The method to use capistrano and env rails in explained in Using Environment Variables in Rails, Heroku, Capistrano
使用capistrano和env rails的方法在Rails,Heroku,Capistrano中使用环境变量中进行了解释
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.