I am trying to use plotly from a Google App engine app. The standalone python program works but when I try to incorporate it in my google app engine app, I get import errors for sqlite and plotly both of which are needed for my project. How can I get GA Engine to recognize these imports?
The code boiled down to the simplest is this:
form="""
<form action="/sqlhandler">
<input name="q">
<input type="Submit">
</form>
"""
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/html'
self.response.write(form)
class SQLHandler(webapp2.RequestHandler):
def get(self):
q = self.request.get("q")
import sql_queries
url = sql_queries.plot_graph(q)
self.response.headers['Content-Type'] = 'text/html'
self.response.write(url)
app = webapp2.WSGIApplication([
('/', MainPage),
('/sqlhandler', SQLHandler)
], debug=True)
Neither sqlite3 nor plotly are available on GAE by default (see https://cloud.google.com/appengine/docs/python/tools/libraries27).
In order to use them, you have to include the source files of these libraries in your GAE application and upload them with the rest of the project.