₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,326,244 members, 8,425,675 topics. Date: Friday, 12 June 2026 at 09:09 PM

Toggle theme

How I Ran Django On My Android Phone - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHow I Ran Django On My Android Phone (1052 Views)

1 Reply (Go Down)

How I Ran Django On My Android Phone by ColeDrain(op): 10:02am On Sep 04, 2020
How I ran Django on my android phone

Yeah, it seems weird coding with your phone, but right now I don't have an option, so if you are like me or you just fancy the idea, you can also do this. This is not an introduction to Django tutorial but how to work on Django with your android.


First we need something like a Linux terminal(or CLI) for android. Lucky for us, there is a terminal emulator on Google play store called Termux, so head to playstore and install it.
Link:termux


Okay, so you have installed it, what next?
So basically you can do whatever you could do on a Linux terminal now with this app(create directories, move files, change directory). This is how Termux looks like.
https://dev-to-uploads.s3.amazonaws.com/i/63160yviulhadk0ut1as.jpg


So let's roll in. Enter this command to view where Termux saves your files.
$ pwd
https://dev-to-uploads.s3.amazonaws.com/i/90dcxddspy67gaikwtd1.jpg
So that's where Termux saves your files, but the problem is you can't access that folder because of safety issues.

So to be able to access your files..
run this command
$ termux-setup-storage

And allow permission to storage in the popup shown.
https://dev-to-uploads.s3.amazonaws.com/i/c2v89svlzaqub7ojqj75.jpg
Now change directory to your internal shared storage by running this command.
$ cd /sdcard
N:B this command doesn't point to your external SD card but your internal SD card(storage).


Then let's create a folder to store our Django projects, let's call it django_projects.
So run this command.
$ mkdir django_projects
$ cd django_projects


Now let's install python
To install python, run this
$ pkg install python
To check if python is installed, run the python command to enter python console.
$ python

N:B Use ctrl + z to exit the terminal. Termux app comes with a ctrl key.


Let's create a project called mysite
So still in that django_projects, run this commands.
$ mkdir mysite
$ cd mysite

We need a virtual environment to avoid dependencies clash. So let's install a virtual environment, run this command.
$ pip install virtualenv

After installing it, run
$ virtualenv venv
to create a virtual environment.. Then activate the virtual environment by running (note the full stop)
$ . venv/bin/activate


Now we have a virtual environment, let's install Django. run..
$ pip install Django

Okay, so Django is installed in our venv, let's create a Django project. run..
$ django-admin startproject hello .
(note the full stop)

Then let's run migrations..
$ python manage.py migrate

You can then run the server..
$ python manage.py runserver

voilà, go to your phone browser and open
localhost and you should see this.
https://dev-to-uploads.s3.amazonaws.com/i/pziu4sk2ocsraijhpecv.jpg

You can always view your files by going to your file manager and searching for django_projects folder.

Feel free to indulge me, if any issues.
Re: How I Ran Django On My Android Phone by Uzomacharles: 10:27am On Sep 04, 2020
Nice one
Termux all the way
Re: How I Ran Django On My Android Phone by ColeDrain(op): 11:17am On Sep 04, 2020
Uzomacharles:
Nice one

Termux all the way
Thanks man.
Re: How I Ran Django On My Android Phone by Abcruz(m): 1:41pm On Sep 04, 2020
@ColeDrain
Thanks for sharing. Pls do you know if this can also work for Python Flask?
Re: How I Ran Django On My Android Phone by ColeDrain(op): 2:42pm On Sep 04, 2020
Abcruz:
@ColeDrain
Thanks for sharing. Pls do you know if this can also work for Python Flask?
Yeah, it should work bro, just install flask and you can do whatever you want. smiley
Re: How I Ran Django On My Android Phone by Abcruz(m): 3:05pm On Sep 04, 2020
ColeDrain:
Yeah, it should work bro, just install flask and you can do whatever you want. smiley
Thanks I'll do just that.
Re: How I Ran Django On My Android Phone by Nobody: 7:59pm On Sep 07, 2020
Can I run java using this method
Re: How I Ran Django On My Android Phone by ColeDrain(op): 1:30pm On Sep 08, 2020
Chiomzibae:
Can I run java using this method
It's possible, but a bit complex. You are better off using this app javanide
1 Reply

Please, Help Me With Django On My Mobile AppCan I Learn Programming From My Android Phone?I Need Help Installing Django On My Windows Pc..please Anyone Help234

Pgadmin - Please Correct The Binary Path In The Preferences Dialog Solution ForCreated And Deployed My First Express Js Website.Alexis, Please Could You?