kivy / python-for-android

Turn your Python application into an Android APK
https://python-for-android.readthedocs.io
MIT License
8.34k stars 1.85k forks source link

Django App is not running. Web View does not load it #1083

Closed Kozubi closed 5 years ago

Kozubi commented 7 years ago

Hello, I made a simple hello-world Django app to check if it can be compiled with webview bootstrap. I used following command:

python-for-android apk --ndk-dir /home/mk/Pulpit/kivy/crystax-ndk-10.3.2 --requirements=python3crystax,sqlite3,django --bootstrap=webview --port=8000 --android_api=19 --name=djangusek --version=0.1 --package=com.kozubi.dj --private=bin

App is loaded on phone BUT it stays on loading screen. Logcat:

08-01 17:19:46.668  7712  7776 I python  : Initialized python
08-01 17:19:46.668  7712  7776 I python  : AND: Init threads
08-01 17:19:46.668  7712  7776 I python  : testing python print redirection
08-01 17:19:46.670  7712  7776 I python  : Android path ['.', '/data/user/0/com.kozubi.dj/files/crystax_python/stdlib.zip', '/data/user/0/com.kozubi.dj/files/crystax_python/modules', '/data/user/0/com.kozubi.dj/files/crystax_python/site-packages']
08-01 17:19:46.670  7712  7776 I python  : os.environ is environ({'ANDROID_DATA': '/data', 'PYTHON_NAME': 'python', 'ASEC_MOUNTPOINT': '/mnt/asec', 'ANDROID_STORAGE': '', 'ANDROID_ENTRYPOINT': 'main.pyo', 'BOOTCLASSPATH': '/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/apache-xml.jar:/system/framework/org.apache.http.legacy.boot.jar:/system/framework/hwEmui.jar:/system/framework/hwTelephony-common.jar:/system/framework/hwframework.jar:/system/framework/org.simalliance.openmobileapi.jar:/system/framework/hwaps.jar:/system/framework/hwcustEmui.jar:/system/framework/hwcustTelephony-common.jar:/system/framework/hwcustframework.jar:/system/framework/VireCustomFramework.jar', 'ANDROID_BOOTLOGO': '1', 'ANDROID_ROOT': '/system', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/hwServices.jar:/system/framework/hwWifi-service.jar:/system/framework/hwcustServices.jar:/system/framework/hwcustwifi-service.jar', 'ANDROID_PROPERTY_WORKSPACE': '11,0', 'EXTERNAL_STORAGE': '/sdcard', 'ANDROID_SOCKET_zygote_secondary': '12', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'PYTHONPATH': '/data/user/0/com.kozubi.dj/files:/data/user/0/com.kozubi.dj/files/lib', 'ANDROID_ARGUMENT': '/data/user/0/com.kozubi.dj/files', 'PYTHONHOME': '/data/user/0/com.kozubi.dj/files', 'ANDROID_APP_PATH': '/data/user/0/com.kozubi.dj/files', 'ANDROID_PRIVATE': '/data/user/0/com.kozubi.dj/files', 'CUST_POLICY_DIRS': '/system/emui/base:/system/emui/oversea:/system/emui:/system/global:/system/etc:/cust_comm', 'ANDROID_ASSETS': '/system/app'})
08-01 17:19:46.670  7712  7776 I python  : Android kivy bootstrap done. __name__ is __main__
08-01 17:19:46.670  7712  7776 I python  : AND: Ran string
08-01 17:19:46.670  7712  7776 I python  : Run user program, change dir and execute entrypoint
08-01 17:19:46.670  7712  7776 I python  : main.py
08-01 17:19:46.670  7712  7776 I python  : Entrypoint not found (.pyo, fallback on .py), abort 
inclement commented 7 years ago

Is your main file named main.py?

Also, I don't think django will work, as there isn't currently a recipe for it. There was one for the old toolchain though, so it shouldn't be hard to add it if necessary.

Kozubi commented 7 years ago

Yes i try with main.py. The problem I think is django is running with manage.py command. I have no idea if it is executed. Btw. where can I find old toolchain?

Kozubi commented 7 years ago

With flask is same :/

python-for-android apk --ndk-dir /home/mk/Pulpit/kivy/crystax-ndk-10.3.2 --requirements=flask,sqlite3 --bootstrap=webview --port=5000 --android_api=19 --name=flasko --version=0.1 --package=com.kozubi.dj --private=bin --permission=INTERNET

Checked both with python3crystax and standard ndk No idea what is wrong :(

inclement commented 5 years ago

Closing as stale.