I'm trying to import the datastore module(or anytime I try to import a
second module for that matter) in my app engine standard code.
I've virtually tried every combination and I'm getting either
Error: Server ErrorThe server encountered an error and could not complete
your request.
Please try again in 30 seconds.
or 502 Gateway ngix errors.
Any thoughts?
Thanks
John Iacovacci
main.py
from flask import Flask, request, render_template
# START Translate requirements
from google.cloud import translate_v2 as translate
translate_client = translate.Client()
import datastore
# END Translate requirements
app = Flask(__name__) # Flask is the web framework we're using
@app.route('/', methods=['POST','GET']) # This defines when the
function below will be called
def translate():
if request.method == 'POST':
# This code will run if a POST is received
data = request.form.to_dict(flat=True) # Reads the body of the post
request and assigns it to the "data" variable
result = translate_client.translate(data['inputText'],
target_language=data["toLang"]) # Sends data to the translate API
return
render_template('index.html',translatedText=result['translatedText']) #
Renders the page with the response
else:
# This code will run if a GET is received
return render_template('index.html')
# Don't worry about this part
if __name__ == '__main__':
app.run(host='127.0.0.1', port=8080, debug=True)
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/66ca4b61-9bc2-48b8-9103-9726c03b12bfn%40googlegroups.com.