我有这个程序,我已经设法上传到heroku没有错误。但当我在浏览器中打开它时,如果我在其中保留一行使用Regexp的代码,就会得到“内部服务器错误”。如果我把它评论出来就好了。
我看过关于Heroku给出“内部服务器错误”的类似标题的问题,但这些问题不涉及Regexp,也没有告诉我需要做什么才能使其正常工作。例如
Heroku deployment internal server error
此人使用的是python,他安装的软件包不兼容,这似乎与我的问题无关。这个
Heroku + Django Internal server Error
一个家伙不得不进口一种叫做DJ芹菜的东西。嗯,也许我必须从某个地方进口一些东西,但我不知道是什么,但那不是django,因为我没有使用django。
C:\rubytest\regexinheroku1>dir /b
aaa.rb
config.ru
Gemfile
Gemfile.lock
C:\rubytest\regexinheroku1>
这是aaa。rb型
C:\rubytest\regexinheroku1>type aaa.rb
require 'sinatra'
get '/' do
z=Regexp.new('.').match?('qwerty')
"aaaa"
end
这成功了
C:\rubytest\regexinheroku1>git push heroku master
.... deployed to Heroku
但问题是
如果我转到URL,它会显示“内部服务器错误”
然而,如果我改变aaa。rb通过注释掉regexp行
C:\rubytest\regexinheroku1>type aaa.rb
require 'sinatra'
get '/' do
# z=Regexp.new('.').match?('qwerty')
"aaaa"
end
然后,它工作正常,出现一个页面并按预期显示“aaaa”。
如果你想复制这个,而以上还不够,下面是所有的步骤
So you see the files
C:\rubytest\regexinheroku2>dir /b
aaa.rb
config.ru
Gemfile
The contents of each file
C:\rubytest\regexinheroku2>type aaa.rb
require 'sinatra'
get '/' do
z=Regexp.new('.').match?('qwerty') # if I uncomment this, I get internal server error
"aaaa"
end
C:\rubytest\regexinheroku2>type config.ru
require './aaa'
run Sinatra::Application
C:\rubytest\regexinheroku2>
C:\rubytest\regexinheroku2>type Gemfile
source "http://rubygems.org/"
gem 'sinatra'
gem "haml"
And see the commands I run to get the application successfully deployed
C:\rubytest\regexinheroku2>bundle install
...
C:\rubytest\regexinheroku2>git init
Initialized empty Git repository in C:/rubytest/regexinheroku2/.git/
C:\rubytest\regexinheroku2>git add -A
warning: LF will be replaced by CRLF in Gemfile.lock.
The file will have its original line endings in your working directory.
C:\rubytest\regexinheroku2>git commit -m "sddsfsdfsd"
[master (root-commit) 12cf382] sddsfsdfsd
warning: LF will be replaced by CRLF in Gemfile.lock.
The file will have its original line endings in your working directory.
4 files changed, 39 insertions(+)
create mode 100644 Gemfile
create mode 100644 Gemfile.lock
create mode 100644 aaa.rb
create mode 100644 config.ru
C:\rubytest\regexinheroku2>heroku create
path1 gitmisc done
Creating app... done, abc
https://abc.herokuapp.com/ | ....
C:\rubytest\regexinheroku2>git push heroku master
....
remote: Verifying deploy... done.
To https://git.heroku.com/abc.git
* [new branch] master -> master
C:\rubytest\regexinheroku2>