Hello Drone Deploy Community
I got an issue with the Server App setup ( described at this link : https://dronedeploy.gitbooks.io/dronedeploy-apps/content/server_example.html)
I’m a user of heroku , if think it s fine , API Key from Google are ok.
But when i load the app in the browser , i got a 404 ERROR
https://stardrone-server.herokuapp.com
i think it’s the tornado module can’t GET , my console ask me this error :
WARNING:tornado.access:404 GET / (::1) 0.75ms
I think the issue is from the CORS ( HTTP control access) but i have no ideo how to fix it.
Anyone has managed to setup this server ?
thanks for help .
the python code :
import os
import requests
import tornado.ioloop
import tornado.web
GEOCODE_FMT = ‘https://maps.googleapis.com/maps/api/geocode/json?address={address}&key={key}’
class GeocodeHandler(tornado.web.RequestHandler):
“”“Proxy a call to the Google Maps geocode API”“”
def set_default_headers(self): # allow cross-origin requests to be made from your app on DroneDeploy to your web server self.set_header("Access-Control-Allow-Origin", "https://www.dronedeploy.com") self.set_header("Access-Control-Allow-Headers", "x-requested-with") # add more allowed methods when adding more handlers (POST, PUT, etc.) self.set_header("Access-Control-Allow-Methods", "GET, OPTIONS")
def get(self): api_key = os.environ.get("**mykey**") address = self.get_query_argument("address") url = GEOCODE_FMT.format(address=address, key=api_key)
# fetch results of the geocode from Google response = requests.get(url)
# send the results back to the client self.write(response.content)
def options(self): # no body self.set_status(204) self.finish()
def main():
application = tornado.web.Application([
(r"/geocode/", GeocodeHandler)
])
port = int(os.environ.get(“PORT”, 5000))
application.listen(port)
tornado.ioloop.IOLoop.current().start()
if name == “main”:
main()
Any help are welcome , thank you
john