小编nou*_*rza的帖子

如何在颤振中进行年龄验证

我的目标是通过输入的生日检查用户年龄,如果用户不是 18 岁或以上,则返回错误。但我不知道该怎么做。日期格式为“dd-MM-yyyy”。任何想法如何做到这一点?

validation date dart flutter

6
推荐指数
1
解决办法
5126
查看次数

在Heroku上安装GDAL Python绑定

我正在尝试制作一个使用osgeo的GDAL python绑定的heroku应用程序。我已经尝试了几件事,但是没有任何效果。

我无法在部署中安装GDAL python绑定。这些是我当前的构建包

test-gerry的下一个版本将使用:1. heroku / python 2. heroku / nodejs

还有我的requirements.txt

attrs==18.2.0
Click==7.0
click-plugins==1.0.4
cligj==0.5.0
cycler==0.10.0
decorator==4.3.0
Fiona==1.8.4
matplotlib==3.0.2
munch==2.3.2
networkx==2.2
numpy==1.15.1
pandas==0.23.4
pyparsing==2.3.0
python-dateutil==2.7.5
pytz==2018.7
kiwisolver==1.0.1
Shapely==1.6.4.post2
six==1.12.0
scipy==1.1.0
geopandas==0.4.0
gerrychain==0.2.2
pyproj==1.9.5.1
Run Code Online (Sandbox Code Playgroud)

当我将gdal == 2.3.1添加到requirments.txt中时失败

remote: -----> Python app detected
remote: -----> Installing requirements with pip
remote:        Collecting gdal==2.3.1 (from -r /tmp/build_11d41259c199f22382350ebd6af5e868/requirements.txt (line 23))
remote:          Downloading https://files.pythonhosted.org/packages/99/31/2e05c1be3196126fa04028aed51489f40ceea77e8361a80bc8b00fc463db/GDAL-2.3.1.tar.gz (557kB)
remote:        Installing collected packages: gdal
remote:          Running setup.py install for gdal: started
remote:            Running setup.py install for gdal: finished …
Run Code Online (Sandbox Code Playgroud)

python heroku gdal

5
推荐指数
0
解决办法
173
查看次数

设置 Heroku 调试导轨运行器

我是编码新手,一直在开发一个遵循和过时教程的应用程序。当我推送我的 ruby​​ 应用程序时,我已经设法修复了 Heroku 日志中的每条错误消息。当我在 heroku 服务器上运行该应用程序时,它仍然会弹出一条错误消息,并且日志仍然给我这个错误警告消息:

remote: ###### WARNING:
remote: 
remote:        Detecting rails configuration failed
remote:        set HEROKU_DEBUG_RAILS_RUNNER=1 to debug
remote: 
remote: 
Run Code Online (Sandbox Code Playgroud)

我找不到我想在哪里进行此更改,甚至不知道这会做什么。我有一种感觉,这是一个简单的解决方案,但我无法弄清楚。

这是我的 heroku 日志当前显示的内容

2018-12-15T17:21:34.785786+00:00 app[web.1]: => Booting Puma
2018-12-15T17:21:34.785794+00:00 app[web.1]: => Rails 4.2.5 application starting in production on http://0.0.0.0:58573
2018-12-15T17:21:34.785800+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-12-15T17:21:34.785802+00:00 app[web.1]: => Ctrl-C to shutdown server
2018-12-15T17:21:34.785804+00:00 app[web.1]: Exiting
2018-12-15T17:38:25.438993+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fathomless-garden-52262.herokuapp.com request_id=a4f35efc-e682-4350-b203-f6fc40c56b1b fwd="70.112.41.25" dyno= connect= service= status=503 bytes= …
Run Code Online (Sandbox Code Playgroud)

ruby debugging heroku

5
推荐指数
1
解决办法
2754
查看次数

捆绑软件安装找不到与宝石“捆绑包”兼容的版本

当我键入捆绑安装时,出现此错误。我试图找到解决方案,但没有任何解决方案。请帮我。

 Bundler could not find compatible versions for gem "bundler":
      In Gemfile:
        rails (= 4.1.8) was resolved to 4.1.8, which depends on
          bundler (< 2.0, >= 1.3.0)

      Current Bundler version:
        bundler (2.0.1)
    This Gemfile requires a different version of Bundler.
    Perhaps you need to update Bundler by running `gem install bundler`?

    Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails
    (= 4.1.8)', in any of the sources.

    Bundler could not find compatible versions for …
Run Code Online (Sandbox Code Playgroud)

bundle ruby-on-rails

5
推荐指数
3
解决办法
6650
查看次数

rails验证特定值

我有这个代码

我有这些选项,如果用户选择除"不列颠哥伦比亚省"之外的任何东西给他错误消息,该省必须'不列颠哥伦比亚省'

我相信它将通过使用模型验证来解决

<%= f.label :province ,"Province (required)"%><br>
    <%= f.select(:province, [["Select One", ""],'Alberta','British Columbia','Manitoba','New Brunswick','Newfoundland and Labrador','Nova Scotia','Northwest Territories','Nunavut','Ontario','Prince Edward Island','Quebec','Saskatchewan','Yukon'], {}) %>
Run Code Online (Sandbox Code Playgroud)

User.rb

  validates :province, presence: "British Columbia"
Run Code Online (Sandbox Code Playgroud)

validation ruby-on-rails inclusion

4
推荐指数
1
解决办法
2274
查看次数

mandril 拒绝原因:未签名

由于 mandrill 开始使用 mailchimp,所以我必须在 mailchimp 中创建一个新帐户,然后我在开发人员和生产页面中更新了我的代码。但是当我开始发送电子邮件时,它没有收到,并且在 manderill 帐户中,我收到了拒绝原因:未签名

任何人都可以帮我修复它吗?

谢谢

ruby-on-rails actionmailer mailchimp mandrill

3
推荐指数
1
解决办法
3311
查看次数

将 Heroku 上的远程分支合并到 Heroku Master 以触发构建

我已将一些更改推送到 Heroku 上的远程分支,我需要将此分支合并到 Heroku 上的主分支以触发应用程序的新构建。这可以做到吗?这可以使用 Heroku-cli 来完成吗?

git heroku heroku-cli

2
推荐指数
1
解决办法
2464
查看次数

如何在Rails应用程序的ruby中添加404错误页面?

你能帮我吗 我想将404错误页面添加到我的网站。我尝试了很多方法,但是对我没有用。这是其中之一。

应用控制器

unless  ActionController::Base.consider_all_requests_local
  rescue_from Exception, :with => :render_404
end

private

  def render_404
    render :template => 'error_pages/404', :layout => false, :status => :not_found
  end
Run Code Online (Sandbox Code Playgroud)

然后设置error_pages / 404.html

谁能解决这个问题?

ruby-on-rails http-status-code-404

1
推荐指数
1
解决办法
542
查看次数