Raspberry Pi Django Tutorial 2017

1. Setup Project Files Raspberry Pi Django Web App

This is a Raspberry Pi Tutorial Django project that can be found at: https://github.com/mavieth/Raspberry-Pi-Django-Web-App

2. Install Virtual Environment for Django Web App

This is so we can install python packages without having to run with the sudo command for our project.

3. Create Virtual Environment and Activate

After this command you should have an (env) before your terminal to let you know that you have activated the virtual environment.

4. Install Django on your Raspberry Pi, and Create the Project Files

This may take a few minutes as it will be install Django to run on your Raspberry Pi

6. Edit the ALLOWED_HOSTS

On line in ~/projects/django-rpi/raspberrypiapp/raspberrypiapp/settings.py , where 10.0.0.22 is the IP address of your Raspberry Pi

7. Migrate Changes and Start the Server!

 

This will start an application on http://localhost:8080 or from another computer on the same network http://10.0.0.22:8080 where 10.0.0.22 is the IP address of your Raspberry Pi.

 

Case for the Official Raspberry Pi 7″ Touchscreen Display – Adjustable angle (Personal Computers)


List Price: $27.99 USD
New From: $27.99 USD In Stock
Used from: Out of Stock

CanaKit Raspberry Pi 3 with 2.5A Micro USB Power Supply (UL Listed) (Personal Computers)


List Price: $49.99 USD
New From: $42.99 USD In Stock
Used from: $45.27 USD In Stock

 

You can find my project files at https://github.com/mavieth/Raspberry-Pi-Django-Web-App

Please comment below if you have any questions!

You may also like...

7 Responses

  1. Laslarailas says:

    Hours trying make pip works on my RasPy, finally this command do the installation of pip: sudo apt-get install python-pip

  2. Andrew says:

    Are you going to update part 2 of the original tutorial?

    • RPi Admin says:

      Those tutorials were functional at the time posted, so I will leave them as is. This should be used for people who have more recently updated OS’s on their pi.

  3. Mark says:

    Super straight forward and easy – got Django up and running on Arch on my Raspberry Pi in minutes. Thanks!

  4. Martin Harvey says:

    ALLOWED_HOSTS = [“localhost”,”10.0.0.22″]

    Error
    What happen to number 5 ?
    You have 1 to 4 then 6 & 7
    Many thanks
    Martin

    • RPi Admin says:

      Hmmm…. I am not sure why I skipped #5. I do not believe that I left a step out, it may just have been an error in my copywriting.

      -A man of many mistakes

  5. Scott says:

    All i get is Traceback (most recent call last):
    File “manage.py”, line 17, in
    “Couldn’t import Django. Are you sure it’s installed and ”
    ImportError: Couldn’t import Django. Are you sure it’s installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
    when i try to run step 7.

Leave a Reply

Your email address will not be published. Required fields are marked *