我正在尝试从Github克隆的应用程序。
https://github.com/sfujiwara/qa-system-sample.git (此应用使用python烧瓶,Google自然语言API等)。
但是,我无法在Google App Engine上运行它。发生以下错误。
错误:
ImportError: cannot import name types
at <module> (/base/data/home/apps/b~qa-system-sample2/20171223t122211.406411375873194303/lib/google/cloud/language_v1/__init__.py:17)
at <module> (/base/data/home/apps/b~qa-system-sample2/20171223t122211.406411375873194303/lib/google/cloud/language.py:17)
at <module> (/base/data/home/apps/b~qa-system-sample2/20171223t122211.406411375873194303/factoid.py:5)
at <module> (/base/data/home/apps/b~qa-system-sample2/20171223t122211.406411375873194303/main.py:9)
at LoadObject (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:85)
at _LoadHandler (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:299)
at Handle (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:240)
Run Code Online (Sandbox Code Playgroud)
这发生from google.cloud.language_v1 import types在lib / google / cloud / language_v1 / _ _init__.py中。虽然,/ lib / google / cloud / language_v1中有types.py。
我是python的初学者,所以我找不到导致此错误的原因。请告诉我解决此错误的方法。
使用rails5的form_with,我想通过单击GET按钮显示当前时间文本。但是文本不会更新。
文字未更新。
users_controller.rb正在关注。
require 'date'
class UsersController < ApplicationController
def index
@message = Time.now.to_s
end
end
Run Code Online (Sandbox Code Playgroud)
index.html.erb正在关注。
<div><%= @message %></div>
<%= form_with method: :get, url: users_path do |form| %>
<%= form.submit 'SUBMIT'%>
<% end %>
<%= link_to 'LINK', { :controller => :users, :action => :index } %>
Run Code Online (Sandbox Code Playgroud)
请告诉我如何在当前时间更新文本。
注意:
当按下链接(通过link_to辅助方法呈现)时,文本将更新。
按链接...
然后更新文字。
为什么我可以通过链接更新文本?
编辑:
单击按钮后的服务器日志如下。
Started GET "/users?utf8=%E2%9C%93&commit=SUBMIT" for 127.0.0.1 at 2018-08-17 19:13:32 +0900
Processing by UsersController#index as JS
Parameters: {"utf8"=>"?", "commit"=>"SUBMIT"}
Rendering users/index.html.erb within layouts/application
Rendered users/index.html.erb …Run Code Online (Sandbox Code Playgroud)