简体   繁体   English

缺少'secret_token`和`secret_key_base`用于'生产'环境

[英]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 and secret_key_base for 'production' environment, set these values in config/secrets.yml > 机架应用程序错误:#<RuntimeError:缺少'生产'环境的secret_tokensecret_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_BASEprintenv | 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.

相关问题 在生产环境中缺少secret_token和secret_key_base,请在config / secrets.yml中设置这些值 - Missing secret_token and secret_key_base for production environment, set these values in config/secrets.yml “生产”环境(Puma)缺少“ secret_token”和“ secret_key_base” - Missing 'secret_token' and 'secret_key_base' for 'production' environment (Puma) 在“开发”环境中缺少“ secret_token”和“ secret_key_base”,请在“ config / secrets.yml”中设置这些值 - Missing `secret_token` and `secret_key_base` for 'development' environment, set these values in `config/secrets.yml “开发”环境缺少“secret_token”和“secret_key_base”,请在“config/secrets.yml”中设置这些值 - Missing `secret_token` and `secret_key_base` for 'development' environment, set these values in `config/secrets.yml` Rails 6 secret_key_base 与 secret_token - Rails 6 secret_key_base vs secret_token 缺少`secret_token`和`secret_key_base` - 带有RVM的Rails 4.2.0 - Missing `secret_token` and `secret_key_base` - Rails 4.2.0 with RVM “缺少&#39;secret_key_base`为&#39;生产&#39;环境”Heroku上的错误 - “Missing `secret_key_base` for 'production' environment” error on Heroku ruby on rails:heroku:“生产”环境缺少“secret_key_base” - ruby on rails: heroku: Missing `secret_key_base` for 'production' environment SemiFixed:缺少&#39;secret_key_base`用于&#39;生产&#39;环境 - SemiFixed: Missing `secret_key_base` for 'production' environment Rails:如何修复“生产环境中缺少 secret_key_base” - Rails: How to fix “Missing secret_key_base for 'production' environment”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM