[Fixed]-Python + Django on Android

15đź‘Ť

Yeah! its posible!, but you need install termux terminal on Android and later open the termux terminal and write:

apt-update
apt-install python
pip install django
django-admin startproject demo
cd demo
python manage.py runserver 0.0.0.0:8000

and its all, open localhost:8000 on your browser, see the picture:

enter image description here

12đź‘Ť

We’re developing PythonAnywhere to fill just this kind of niche. We tuned it to work with the iPad first. But it seems that the Nexus 7 is popular enough now that there might be enough demand to do the same thing for Android.

👤aychedee

4đź‘Ť

SL4A is a ridiculously excellent library/sdk/app for android and gives you a way to install a number of language/scripting runtimes and a thin veneer for accessing android functionality via the scripting frameworks.

It so happens that Python is an option, and I’ve used it with cherrypy (python framework) on Android. I haven’t tried it with flask or Django but with some work it should be possible.

The app provides a way to download python, install it, and then a way to launch a python console or even just run python scripts.

http://code.google.com/p/android-scripting/

There was a downside to the python support originally, due to a silly bug/limitation in the Android SDK. This restricted the use of apk assets with _ underscore in the name. The details are faint in my mind, but I am subscribed to the issue in Android so I can follow up with the details about this issue. This would present a problem with many of the python frameworks, as underscores are part of python style.

👤truedat101

3đź‘Ť

One good way to accomplish a django development environment on a Nexus7 is to install a linux distro with a package manager alongside Android. Debian Kit hooks into the existing Android directories with symlinks instead of a chroot environment.

With that you can install Debian or Ubuntu and use apt-get and pip to install git, virtualenv, and all the packages and libraries you need to set up your development environment as you would on a desktop. You can write your code in DroidEdit, run the django development server in an Android terminal through ssh to localhost, and test your app right there in the browser on Android.

👤Mike Drawback

2đź‘Ť

Do you want this? :

p.s: I confess that article’s original source is me. But isn’t it nice? 🙂

👤Kenial

2đź‘Ť

QPython suports Django on Android. I am running it on my android device.

👤Richardd

2đź‘Ť

I could run on my Tablet (android) and smartphone (android) following the procedure below:

  • Install “GNUroot Debian” app;
  • Open “GNUroot Debian” app;
  • Run these commands:

    apt-get update
    apt-get install python3
    apt-get install python3-setuptools
    easy_install3 pip
    pip install django
    django-admin startproject demo
    cd demo
    python manage.py runserver
    

1đź‘Ť

Well if your end goal is to develop Web applications and host host them on your Android and since you had flask there why not give bottle.py a shot. It’s just one file that you copy into your sl4a scripts folder and voila. Bottle is minimalist and near similar to flask. No rooting or Unix environments required.

👤Vikram

1đź‘Ť

Install termux terminal on Android and later open the termux terminal and write:

pkg install python
pip install django
django-admin startproject demo
vim demo/demo/settings.py

In settings.py

ALLOWED_HOSTS = ['*']

After save the settings.py and

python manage.py runserver 0.0.0.0:8000

and its all, open localhost:8000 on your browser

👤ilgnv88

0đź‘Ť

If you are developing an android app and you don’t want to use Java, you might want to consider Kivy http://kivy.org/#home

If you are talking about having a web server running on Android and then running your django web app on that web server itself, there’s a duplicate answer here – Web Server for Android

👤Calvin Cheng

Leave a comment