我的最小应用程序在本地运行,我没有捆绑错误.但是,当我推送到heroku时,构建在资产期间失败:预编译步骤:
...
Bundle completed (3.24s)
Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompole
rake aborted!
LoadError: cannot load such file -- uglifier
(in /tmp/build_.../app/assets/javascripts/application.js)
Run Code Online (Sandbox Code Playgroud)
注意:
1.我没有在本地使用uglifier gem
2.我没有文件app/assets/javascripts/application.js
我尝试过这些Gemfile解决方案:
A)添加uglifier gem
B)将uglifier添加到资产组
C)从Gemfile中完全删除uglifier并rake卸载所有版本
下一步是什么?
我使用Pony邮件发送电子邮件(因为我永远无法让ActionMailer在我的本地Windows机器上工作).
我的user_mailer.rb文件中的代码包含对Pony.mail方法的调用:
Pony.mail({
:to => email_address,
:from => 'MyChairSales <support@mychairsales.com>',
:subject => subject,
:body => email_body,
:html_body => html_body,
:via => :smtp,
:via_options => {
:address => 'mail.mychairsales.com',
:port => '25',
:enable_starttls_auto => true,
:user_name => 'mychairs',
:password => 'thepassword',
:domain => "mychairsales.com" # the HELO domain provided by the client to the server
}
})
Run Code Online (Sandbox Code Playgroud)
这是有效的(我已经使用此方法收到了电子邮件),但现在失败了,错误"主机名与服务器证书不匹配".
这是堆栈跟踪的顶部:
["/usr/lib64/ruby/1.9.3/openssl/ssl-internal.rb:121:in `post_connection_check'",
"/usr/lib64/ruby/1.9.3/net/smtp.rb:585:in `tlsconnect'", "/usr/lib64/ruby/1.9.3
/net/smtp.rb:560:in `do_start'", "/usr/lib64/ruby/1.9.3/net/smtp.rb:519:in `start'",
"/home4/mychairs/ruby/gems/gems/mail-2.4.4/lib/mail/network/delivery_methods
/smtp.rb:144:in `deliver!'", "/home4/mychairs/ruby/gems/gems/mail-2.4.4/lib
/mail/message.rb:245:in `deliver!'", "/home4/mychairs/ruby/gems/gems/pony-1.4/lib
/pony.rb:166:in `deliver'", "/home4/mychairs/ruby/gems/gems/pony-1.4/lib
/pony.rb:138:in `mail'", "/home4/mychairs/rails_apps/chairsales/app/mailers …Run Code Online (Sandbox Code Playgroud) 为什么 col-sm-offset-2 不以这种形式将按钮 'two' 与上方的 col-sm-2 标签对齐?

我使用空标签(请参阅按钮“一”)对其进行了蹩脚的修复,但我想了解如何使用更简洁的代码并使其正确,以便我的所有表单中都没有按钮的杂乱标签。
<form class="form-horizontal" role="form" action="/company/create" method="post">
<div class="form-group">
<%= label_tag(:name, 'Company name:', :class => 'control-label col-sm-2') %>
<div class="col-sm-4">
<%= text_field_tag(:name, @company.name, :class => 'form-control') %>
</div>
</div>
<div class="form-group">
<%= label_tag(:category, 'Category:', :class => 'control-label col-sm-2') %>
<div class = 'col-sm-4'>
<%= collection_select(nil, :category_id, Category.all, :id, :description, :include_blank => 'select') %>
</div>
</div>
<div class="form-group">
<%= label_tag(:x, '', :class => 'col-sm-2') %>
<div class='col-sm-2'>
<button type="submit" class="btn btn-primary">one</button>
</div>
</div>
<div class="form-group"> …Run Code Online (Sandbox Code Playgroud) 我正在使用Python和Flask构建一个简单的交互Web应用程序。使用Chrome在localhost:5000上进行测试。
我有一个模板和一个相关的javascript文件,位于:./templates/main.html ./templates/main_scripts.js
main.html模板包括如下脚本文件:
<script src="main_scripts.js"></script>
Run Code Online (Sandbox Code Playgroud)
当我使用此Python代码渲染模板时...
return render_template('main.html', session_id=session_id, title=sess.title)
Run Code Online (Sandbox Code Playgroud)
呈现了main.html页面,但我在Chrome控制台中收到此错误:
Failed to load resource: the server responded with a status of 404 (NOT FOUND)
Run Code Online (Sandbox Code Playgroud)
当发生错误时,使用Chrome控制台检查未找到的“ main_scripts.js”的位置,浏览器认为它正在尝试从我的虚拟环境中将其加载到:
./env/Scripts/main_scripts.js
Run Code Online (Sandbox Code Playgroud)
...而不是与模板位于同一目录。
我似乎无法强迫渲染的模板了解其脚本文件所在的位置。到目前为止,我已经尝试了src路径,例如“ ./main_scripts.js”,甚至“ /appdir/main_scripts.js”,其结果完全相同。