oswako Posted June 8, 2017 Posted June 8, 2017 Hello I need to run a web app with web.py, Some other devices will Post and Get to the App and this last one needs to be able to reply to the caller with a json package, eventually this App will connect to the postgres database already in place here at heliohost.But I have encounter problems when trying to run the python script. and want to know if this is even possible to do here at Helioshost. Configuration: Server: jhonnyWebsite: oswako.helioshost.org/cgi-bin/helloword.pyFile path: public_html/cgi-bin/helloworld.pyFile Permission: 755 Code: #!/usr/bin/env pythonimport psycopg2import webimport json print("Content-type: text/html\n\n") urls = ( '/', 'index', '/jsonp', 'jsonp') class index: def GET(self): return "Hello, world!" class jsonp: def POST(self): data = json.loads(web.data()) print data['ID'] print data['MAC'] web.header('Content-Type', 'application/json') return json.dumps(data) if __name__ == '__main__': app = web.application(urls,globals()) app.run() Note: The code has been verify on python and works fine on http://localhost:8080/ returning hello world. Error: when I try to run it in oswako.heliohost.org/cgi-bin/helloworld.py/ comes back with: Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, webmaster@oswako.heliohost.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. I have seem other forums from people trying to do something like this on helioshost but I can't find out if they were successful or not. thank you for your guidance and help in advanced. Oswaldo
Krydos Posted June 8, 2017 Posted June 8, 2017 We support Django and Flask on Tommy, and Flask on Ricky. Would either of those frameworks work for you?
oswako Posted June 8, 2017 Author Posted June 8, 2017 Thank you for the support, flask will do, could it be supported on Johnny at some point?Should i transfer to Ricky or Tommy and request again to have access to postgres on the new server?
Krydos Posted June 8, 2017 Posted June 8, 2017 Yeah, we will probably install flask at some point on Johnny. Yes, both Ricky and Tommy support remote postgresql connections.
oswako Posted June 12, 2017 Author Posted June 12, 2017 Hello , I have Change Server to Ricky and requested remote postgresql connections, now I'm trying to run flask on Ricky as described in the following link http://www.helionet....ohnny/?p=128919, but all I can see when I try to run the application in my browser as http://ioteche.heliohost.org/flask/ and the result is: Index of /flask Name Last modified Size Description Parent Directory - a.htaccess 2017-06-12 07:45 185 flask.wsgi 2017-06-12 07:46 253 myapp.py 2017-06-12 08:02 526 Also if I type the http://ioteche.heliohost.org/flask/myapp.py the code text shows up like this: #!/usr/bin/env pythonimport sysfrom flask import Flask, __version__app = Flask(__name__)application = app@app.route("/")def hello():return """HelioHost rules!<br><br><a href="/flask/python/version/">Python version</a><br><a href="/flask/flask/version/">Flask version</a>"""@app.route("/python/version/")def p_version():return "Python version %s" % sys.version@app.route("/flask/version/")def f_version():return "Flask version %s" % __version__if __name__ == "__main__":app.run() I would like to use python 2.7 version with flask on Ricky, at this time I'm just following the little flask tutorial posted on your forum, link that is written on the top of this message. What I'm doing wrong? thanks in advance
Krydos Posted June 12, 2017 Posted June 12, 2017 In that folder create a .htaccess fileYou named your file a.htaccesswhen it's supposed to be starting with the period. No a: .htaccessThere is a space between a and .htaccess in my guide.
oswako Posted June 12, 2017 Author Posted June 12, 2017 Hi, So sorry, I couldn't see the .htaccess on the file manager and that is why I mistakenly named it a.htaccess after going to Settings on file manager and then clicking on the option Show Hidden Files (dotfiles)then I could see the dotfiles and now is working. Thank you.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now