Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webview - flask server crashes immediately #739

Closed
jligeza opened this issue May 11, 2016 · 5 comments
Closed

webview - flask server crashes immediately #739

jligeza opened this issue May 11, 2016 · 5 comments

Comments

@jligeza
Copy link

jligeza commented May 11, 2016

I've used buildozer to create a ,,hello world'' app using a webview and flask. Unfortunately, it crashes right away with error ERR_CONNECTION_RESET, and once I press a link to http://127.0.0.1:5000/, the error changes to ERR_CONNECTION_REFUSED.

adb logcat: http://pastebin.com/W6rs1bB6

main.py:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
app = Flask(__name__)


@app.route('/')
def main_page():
    return 'hello world'

app.run(debug=True, host='0.0.0.0')

minimal buildozer.spec:

[app]
title = Webview test
package.name = webviewtest
package.domain = org.webviewtest
source.dir = .
source.include_exts = py,png,jpg,kv,atlas
version = 0.1
requirements = webviewjni,hostpython2,flask
android.bootstrap = webview
orientation = portrait
fullscreen = 1
android.permissions = INTERNET
[buildozer]
log_level = 2
warn_on_root = 1

PS: the apk weight is only 5,5mb, what is quite nice.

@inclement
Copy link
Member

I had problems using debug=True, but I can't remember what happened exactly. Could you try disabling that to see if it works? You could also remove the host argument just in case, but I don't know if that could be relevant.

@inclement
Copy link
Member

Also, for what it's worth the webview bootstrap should automatically include the INTERNET permission so you can leave that out if you like.

@jligeza
Copy link
Author

jligeza commented May 11, 2016

@inclement Indeed, removal of debug = True makes it mork, that means a text ''hello world'' displays correctly. It also works with host argument.

@inclement
Copy link
Member

Great. I don't think this problem is something p4a can fix (since it seems to relate to flask's use of a subprocess, which won't work on android), so I'll close this issue.

@inclement
Copy link
Member

I've added a note in the doc about it, for what that's worth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants