Wednesday, 30 June 2021

Problem using Flask 2.0.0 with jython gradle plugin

I am new to android development, but not to programming. I am expert with python but I can't manage to use java according to my wishes. So I used the jython gradle plugin. In my main.py, I have the following code:

from flask import Flask

app = Flask(name)

@app.route("/") def home(): return "hello world"

if name == "main": app.run(debug=False, port=8118)

Then in my java code, I create a webview and load the url "http://localhost:8118". But it throws out the error, net::ERR_CONNECTION_REFUSED. I thing the jython plugin fails to create the flask app and run it in the android phone and access it in the webview. Well it can be some other problem too. In my build.gradle( Project ):

task testJython(type:jython.JythonTask) {
jython{
pypackage 'Flask:2.0.0'
}
script file("C:/Users/username/AndroidStudioProjects/my-app-name/app/src/main/assets/main.py")
}

My main.py is in the assets folder. How to solve this problem?



from Problem using Flask 2.0.0 with jython gradle plugin

No comments:

Post a Comment