Django + Raspberry Pi Tutorial (PART I)
UPDATE (1/11/2017): The new tutorial can be found at: http://raspberrypituts.com/raspberry-pi-django-tutorial-2017/
This tutorial will walk you through how to setup your Raspberry Pi with Django. If you have any problems setting up the Django + Raspberry Pi Tutorial (PART I) setup be sure to comment questions or suggestions, be sure to post them at the bottom of the page. If you’d like to become a contributor or edit for the Django + Raspberry Pi Tutorial (PART I) please feel free to contact me.
Start: Django + Raspberry Pi Tutorial (PART I)
Step 1. Updating and Cleaning your Raspberry Pi
sudo apt-get update -y sudo apt-get upgrade -y sudo apt-get autoremove
Step 2. Install Python MySQLDB
sudo apt-get install python-mysqldb -y
Step 3. Install LAMP Server
The second install on this step will ask you to create a password for the root SQL user.
sudo apt-get install apache2 -y sudo apt-get install mysql-server mysql-client -y sudo apt-get install php5 libapache2-mod-php5 php5-mysql -y sudo service apache2 restart
Step 4. Install PHPMyAdmin and configure it to Apache.
This step will ask you which server you would like to use for your application. I chose Apache.
sudo apt-get install phpmyadmin -y sudo nano /etc/apache2/apache2.conf
sudo service apache2 restart
Step 5. Install Python Setup tools
sudo apt-get install python-setuptools -y
Need a new SD Card?
Step 6. Make sure you have PIP installed
wget https://bootstrap.pypa.io/get-pip.py sudo python get-pip.py sudo rm -rf get-pip.py
Step 7: Install Django
sudo pip install Django
Step 8: Creating our application
I will use the name DjangoProject but you can call yours whatever you prefer.
django-admin startproject DjangoProject cd DjangoProject
Step 9: Migrating DB and Running App
Migrate the DB and starting our application. Use your Raspberry Pi IP address (mine is 192.168.0.5) and choose what port you’d like to run on.
python manage.py migrate python manage.py runserver 192.168.0.5:8000
You can then head to 192.168.0.5:8000 from your computer and you should see this if everything worked properly.
Step 10: Customize our App
Check out the next tutorial.