我需要ActiveStorage中的新函数resize_to_fill,因此我升级到了Ruby 2.5.1和Rails 6。
ruby '2.5.1'
gem "rails", github: "rails/rails"
当我停止然后启动服务器(Cloud 9)时,我收到了Rails错误:
阻止的主机:xxxxxxx-xxxxxxx.c9users.io要允许对xxxxxxx-xxxxxxx.c9users.io的请求,请添加以下配置:
Rails.application.config.hosts <<“ xxxxxxx-xxxxxxx.c9users.io”
我尝试过重新启动,新窗口,但是没有任何东西可以解决。我以前从未见过此错误。我猜新版本的Rails正在做什么?
在第3章测试期间,我收到以下警告,这可以忽略吗?
RubyDep:警告:你的Ruby过时/错误.请升级.(要禁用>警告,请设置RUBY_DEP_GEM_SILENCE_WARNINGS = 1)运行选项: - 种子18589
使用sqlobject.当我导入模块时,运行lambda local或remote时无法加载模块错误.该模块已安装,如果我得到一个命令行python3解释器并导入该模块,它导入就好了.
如何安装第三方模块,以便它们同时使用lambda local和lambda remote?
代码不能简单:
import sqlobject
我需要从Cloud9 IDE登录到Heroku的帮助。
在cloud9 IDE终端中,我输入了heroku login,但没有机会输入任何凭据。  
相反,我得到以下
heroku: Press any kety to open up the browser to login or q to exit: 
我按下任意键并得到以下信息:
heroku: Waiting for login...
尝试预览正在开发的邮件程序,但出现上述错误。(使用迈克尔·哈特尔教程)。
我相信它不起作用是因为我的主机。然而,使用cloud 9我很难找到我的主机是什么。在书中,它被定义为host ='rails-tutorial-mhartl.c9users.io'Cloud IDE,但这对于本书作者来说是独一无二的。
我尝试使用 localhost,但它不起作用,并且我的开发 URL 与书中的内容不同(如果涉及以下内容):"..0.vfs.cloud9.us-east-2.amazonaws.com/"
本质上,如果我能找到我独特的 Cloud IDE 主机,问题应该得到解决,但我不知道在哪里找到它
开发.rb
config.action_mailer.raise_delivery_errors = true  
config.action_mailer.delivery_method = :test  
host = 'localhost:8080' 
config.action_mailer.default_url_options = { host: host, protocol: 'http' }
account_activation.html.erb
<h1>Sample App</h1>
<p>Hi <%= @user.name %>,</p>
<p>
  Welcome to the Sample App! Click on the link below to activate your account:
</p>
<%= link_to "Activate", edit_account_activation_url(@user.activation_token,
                                                email: @user.email) %>
该页面应该加载电子邮件预览,但完整的错误消息是:
缺少链接的主机!请提供 :host 参数,设置 default_url_options[:host],或设置 :only_path 为 true
我无法在网站上显示我的CSS。我真的不知道我在做什么错,我对这一切都是新手,所以我确定有些事情我看不到。
这是实时网站 https://rusne118.github.io/mile-stone-one/4
当我尝试在 AWS Cloud 9 上创建环境时,会发生这种情况:
环境创建失败,报错:The development environment 'dda98b3b81134eb18121b0fdf83fdc66' failed to create。删除 AWS CloudFormation 中的“aws-cloud9-AlgumProjeto-dda98b3b81134eb18121b0fdf83fdc66”堆栈,然后再次尝试创建开发环境。
我在做账号的时候才能够创建环境,但是关闭它并再次打开另一个服务器后,上面出现了这个错误。
我遇到一个问题,即闪现消息未显示重定向之前设置的消息。我创建了一个简单的项目来重现该问题。无论是否有 SERVER_NAME 配置文件,重定向闪现消息都不会显示,但常规闪现消息始终会显示。
import sys
import os.path
from flask import Flask, flash, redirect, render_template, url_for
class TestConfig:
    DEBUG = True
    SERVER_NAME = 'project-username.c9users.io'
app = Flask(__name__)
app.secret_key = 'my_secret_key'
@app.route('/')
def index():
    flash('This is a regular test flash')
    return render_template('test.html')
@app.route('/flash')
def flash_it():
    flash('This is a redirect test flash')
    return redirect(url_for('index'))
app.run(host='0.0.0.0', port=8080)
和模板:
{% for message in get_flashed_messages() %}
{{ message }}
{% endfor %}
更新
我尝试使用 localhost 而不是通过 cloud9 界面获得的域名从命令行调用此函数。而且效果很好。
$ wget -q -O - "$@" http://localhost:8080/flash
This …下面是我的 Node app.js 代码。使用这些设置,我收到连接超时错误。知道我在这里缺少什么吗?
var nodemailer = require("nodemailer");
var transporter = nodemailer.createTransport({
  host: 'smtp.zoho.com',
    port: 465,
    secure: true, // use SSL
    auth: {
        user: '<myemail@example.com>',
        pass: '<myemailpassword>'
    }
});
var mailOptions = {
  from: "<fromemail@example.com>",
  to: "<toemail@example.com>",
  subject: "Hello",
  generateTextFromHTML: true,
  html: { path: './tmpl.html' }
};
transporter.sendMail(mailOptions, function(error, response) {
  if (error) {
    console.log(error);
  } else {
    console.log(response);
  }
  transporter.close();
});
显示错误
{ Error: Connection timeout
    at SMTPConnection._formatError (/home/ubuntu/workspace/mailapp/node_modules/nodemailer/lib/smtp-connection/index.js:557:19)
    at SMTPConnection._onError (/home/ubuntu/workspace/mailapp/node_modules/nodemailer/lib/smtp-connection/index.js:530:20)
    at Timeout._connectionTimeout.setTimeout (/home/ubuntu/workspace/mailapp/node_modules/nodemailer/lib/smtp-connection/index.js:248:18)
    at ontimeout (timers.js:380:14)
    at …cloud9 ×10
cloud9-ide ×2
node.js ×2
python ×2
ruby ×2
aws-cloud9 ×1
aws-lambda ×1
cloud ×1
css ×1
docker ×1
environment ×1
flask ×1
git ×1
github ×1
github-pages ×1
heroku ×1
ide ×1
nodemailer ×1
smtp ×1
zoho ×1