python for android - Django error when deployed on android device

89 Views Asked by At

I am currently using Python for android (p4a) to deploy static react files to a Django backend which spawns the server on the android gadget itself - and hosts the web app on a localhost webview.

This is my build.sh I am using to build the application:

export ANDROIDSDK="/Users/xxx/Library/Android/sdk"
export ANDROIDNDK="/Users/xxx/Library/Android/sdk/ndk/25.1.8937393"
export ANDROIDAPI="30"  # Target API version of your application
export NDKAPI="21"  # Minimum supported API version of your application

p4a apk --private . \
    --package=xyz.ann.test \
    --name "TestAppName" \
    --version 0.1 \
    --bootstrap=webview \
    --requirements=python3,hostpython3,django,asgiref,sqlparse,pytz \
    --permission INTERNET --permission WRITE_EXTERNAL_STORAGE \
    --port=8000 --icon icon.png \
    --arch=armeabi-v7a --arch=arm64-v8a \

When I deploy the app on the phone, it currently crashes on start. On running adb logcat, here's the error I see:

12-13 01:27:57.851 19433 19511 I python  : django.core.exceptions.ImproperlyConfigured: 'django.db.backends.sqlite3' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of:
12-13 01:27:57.851 19433 19511 I python  :     'mysql', 'oracle', 'postgresql'
12-13 01:27:57.851 19433 19511 I python  : Python for android ended.

I have tried multiple solutions including downgrading Django, trying different python versions, etc. but have hit a roadblock.

Any help would be awesome!

0

There are 0 best solutions below