首页 \ 问答 \ Ubuntu 14.04 VPS Rails上未加载环境变量(Environment variables not loaded on Ubuntu 14.04 VPS Rails)

Ubuntu 14.04 VPS Rails上未加载环境变量(Environment variables not loaded on Ubuntu 14.04 VPS Rails)

这让我疯狂了几天,我无法弄清楚如何解决这个问题。 我是新手,所以它可能只是非常简单。

我使用Digital Ocean在Ubuntu 14.04上设置我的VPS主机,将我的Rails 4应用程序部署到生产环境。 我按照本教程使用Capistrano和Nginx部署了我的应用程序https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-美洲狮

我目前唯一的问题是我的环境变量没有被我的应用程序加载。 或者至少,当我尝试订阅我的时事通讯时,它告诉我需要一个有效的api密钥。

到目前为止我做了什么:

  • 按照文档中的说明安装rbenv-var。
  • 在我的/ appname / current文件夹中创建了一个.rbenv-var文件
  • 当我运行rbenv vars时,一切看起来都还可以
  • 运行源〜/ .bash_profile(发现这可以解决问题,但它没有)
  • 试图在某处显示“弹簧停止”,但也没有工作。 Spring没有安装
  • 我也尝试将我的变量添加到我的〜/ .bashrc文件中,这也不起作用
  • 尝试将它们添加到我的〜/ .bash_profile文件中,运行source~ / .bash_profile,但这也不起作用。

这是我的bash_profile文件:[[ - - “$ HOME / .profile”]] && source“$ HOME / .profile”#加载默认的.profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM$
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
export MAILCHIMP_API_KEY="somenumber"
export MAILCHIMP_LIST_ID="somenumber"

如果需要,很高兴添加任何额外的代码。

非常感谢!


this is driving me crazy for a few days now and I can't figure out how to solve this. I am new to this so it might just be something very simple.

I set up my VPS hosting on Ubuntu 14.04 using Digital Ocean to deploy my Rails 4 app to a production environment. I deployed my app using Capistrano and Nginx by following this tutorial https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-puma

The only problem that I currently have is that my environment variables are not loaded by my app. Or at least, when I try to subscribe to my newsletter, it tells me that a valid api key is required.

What I did so far:

  • Installed rbenv-var as instructed in the documentation.
  • Created a .rbenv-var file in my /appname/current folder
  • When I run rbenv vars, everything looks OK
  • ran source ~/.bash_profile (found this somewhere that could solve the problem, but it didnt)
  • Tried "spring stop" as indicated somewhere but didn't work either. Spring was not installed
  • I also tried adding my variables to my ~/.bashrc file, that didn't work either
  • Tried adding them to my ~/.bash_profile file, ran source ~/.bash_profile but that didn't work either.

This is my bash_profile file: [[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM$
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
export MAILCHIMP_API_KEY="somenumber"
export MAILCHIMP_LIST_ID="somenumber"

Happy to add any extra code if required.

Thanks a lot!


原文:https://stackoverflow.com/questions/33265843
更新时间:2022-07-20 21:07

最满意答案

一旦在其清单包名称下发布应用程序,这就是应用程序的唯一标识。 切换到其他名称会生成一个全新的应用程序,无法将其安装为现有应用程序的更新。

它无法改变它。 请阅读http://android-developers.blogspot.in/2011/06/things-that-c​​annot-change.html


Once you publish your application under its manifest package name, this is the unique identity of the application forever more. Switching to a different name results in an entirely new application, one that can’t be installed as an update to the existing application.

Its not possible to change it . Please read http://android-developers.blogspot.in/2011/06/things-that-cannot-change.html

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)