小编Res*_*ieC的帖子

Rails 4,如何正确配置smtp设置(gmail)

我正在尝试在Rails 4中创建一个联系表单.我在这里做了一些挖掘,并且能够使大部分内容工作.(关注@ sethfri的工作在这里联系Form Mailer in Rails 4)

现在我可以填写表格框并点击发送.在我的rails服务器中,它说邮件出站到我的电子邮件地址,但我的gmail框中没有收到任何内容,所以我认为我的smtp设置不正确.我的smtp设置是:

...配置/环境/ development.rb

config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true

  config.action_mailer.default_url_options = { :host => 'localhost:3000' }

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address => "smtp.gmail.com",
    :port => "587",
    :domain => "mydomain.net",
    :user_name => "mygmailusername@gmail.com",
    :password => "myGmailPassword",
    :authentication => "plain",
    :enable_starttls_auto => true
  } 
Run Code Online (Sandbox Code Playgroud)

我还添加了 .../config/initializers/smtp_settings.rb

ActionMailer::Base.smtp_settings = {
    :address => "smtp.gmail.com",
    :port => "587",
    :domain => "mydomain.net",
    :user_name => "gmailuser@gmail.com",
    :password => "gmailPassword",
    :authentication => "plain",
    :enable_starttls_auto => true
} …
Run Code Online (Sandbox Code Playgroud)

email smtp ruby-on-rails ruby-on-rails-4

49
推荐指数
4
解决办法
6万
查看次数

Github Api - 如何跟踪移动的回购/项目?

我正在构建一个通过github API跟踪一些github repos的应用程序.当我手动移动或重命名我的应用程序正在跟踪的项目(在github上)时,我失去了它(当我调用旧的api url时获得404).我注意到当我通过浏览器导航到我的旧项目URL时,我得到301并被重定向到正确的页面.有没有一种简单的方法可以通过api找到项目的新位置?也许通过"id"属性或其他东西搜索项目?谢谢!

示例:old:github.com/api/v3/repos/group/app1重命名为:github.com/api/v3/repos/group/app2

当我打电话给github.com/api/v3/repos/group/app2时,当我导航到github.com/group/app1时,我收到了404.我收到301并被重定向到github.com/group/app2

干杯.

github github-api

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

SQLAlchemy Core批量插入速度慢

我正在尝试截断一个表并使用SQLAlchemy仅插入约3000行数据,这非常慢(约10分钟)。

我遵循了此文档上的建议,并利用了sqlalchemy核心来进行插入,但是运行速度仍然非常慢。我有哪些可能的罪魁祸首?数据库是一个postgres RDS实例。谢谢!

engine = sa.create_engine(db_string, **kwargs, pool_recycle=3600)
with engine.begin() as conn:
            conn.execute("TRUNCATE my_table")
            conn.execute(
                MyTable.__table__.insert(),
                data #where data is a list of dicts
            )
Run Code Online (Sandbox Code Playgroud)

python postgresql orm sqlalchemy

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