oswako
-
Posts
13 -
Joined
-
Last visited
Posts posted by oswako
-
-
Thank you so much, i'll correct my code.
-
Hi
I have a flask application that runs perfectly when passing a json package, and returns the same package to the client with no problems but when importing psycopg2 the json package returned is "None" and client complain about the parsing something that is not a json package.
Working Code using json library:
#!/usr/bin/env pythonimport sys#import psycopg2import jsonfrom flask import Flask,request,jsonify, __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__@app.route("/mother")def mother():return "Hello world mother"@app.route("/jsonp",methods=['POST'])def jsonp():webdatajson = request.get_json() # get json package#datajson = jsonify(webdatajson) #make a json package to send backdatajson = json.dumps(webdatajson) #makes a json package to send backreturn(datajson)if __name__ == "__main__":app.run()Another working code using jsonify from flask:
#!/usr/bin/env pythonimport sys#import psycopg2import jsonfrom flask import Flask,request,jsonify, __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__@app.route("/mother")def mother():return "Hello world mother"@app.route("/jsonp",methods=['POST'])def jsonp():webdatajson = request.get_json() # get json packagedatajson = jsonify(webdatajson) #make a json package to send back#datajson = json.dumps(webdatajson) #makes a json package to send backreturn(datajson)if __name__ == "__main__":app.run()NOT WORKING CODE once importing psycopg2:
#!/usr/bin/env pythonimport sysimport psycopg2import jsonfrom flask import Flask,request,jsonify, __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__@app.route("/mother")def mother():return "Hello world mother"@app.route("/jsonp",methods=['POST'])def jsonp():webdatajson = request.get_json() # get json package#datajson = jsonify(webdatajson) #make a json package to send backdatajson = json.dumps(webdatajson) #makes a json package to send backreturn(datajson)if __name__ == "__main__":app.run()I'm trying to get the json from the client and then store the data into the postgresql that is why i need the psycopg2 adapter.
Is this adapter installed or am I doing something wrong?
Also for the future when connecting to the postgresql database from the flask app how should I specify the host? ("http://localhost:5432" or "http://ricky.heliohost.org:5432")
Thanks in advanced
Forgot to mention my data
username: ioteche
domain: ioteche.heliohost.org
server: Ricky -
Ok, thank you.
-
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.
-
First of all Thank you so much for the great support Krydos
Now that I have you for a second , I'm not able to run flask on Ricky by following the little tutorial http://www.helionet....ohnny/?p=128919 , I only can see the index file from the flask folder.
any ideas?
Also any chance that I can run flask with python 2.7?
Thank you in advance.
-
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 526Also if I type the http://ioteche.heliohost.org/flask/myapp.py the code text shows up like this:
#!/usr/bin/env python
import sys
from 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
-
I have recently change Server because Johnny didn't support web.py but Ricky supports flask and I need to kindly request access to the postgresql database for any ip, here is the information
User: ioteche_postgres
Database: ioteche_iotPassword: *********
Port: 5432
host: ricky.heliohost.org
Thank you for your support.
-
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?
-
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: jhonny
Website: oswako.helioshost.org/cgi-bin/helloword.py
File path: public_html/cgi-bin/helloworld.py
File Permission: 755
Code:
#!/usr/bin/env pythonimport psycopg2import webimport jsonprint("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
-
I just downgrade to PgAdmin 3 and is working
thank you so much for the quick support
Regards
Oswald
-
Thank you for doing the changes, now when I try to connect gives' me the following Error:
ERROR: unrecognized configuration parameter "bytea_output"
Any ideas?
-
I'm requesting access to my postgresql database in johnny server via pgadmin 4 for any ip that tries to connect to:
host; johnny.heliohost.org
maintenance DB: oswako_ioteche
username: oswako_postgres
password: *********
port: 5432
Note: the error displayed when I'm trying to connect through pgadmin 4 is FATAL: no pg_hba.conf entry for host "216.75.232.58", user "oswako_postgres", database "oswako_ioteche", SSL off
Please let me know if you need any other info or I"m missing something.
Thank you
There Is No Account In Our Database
in Customer Service
Posted
Hello
When I try to log in to my account at heliohost.org it tells me "There is no account in our database" what happen?
oswako@hotmail.com it was my user account and in my cpannel was ioteche.
what should I do?
thanks