This tutorial is broken into six parts. We’ll build Foodiegram, a simple recipe‑sharing web application using Python 3.5 and Django 1.10. Unlike many tutorials, this one is written conversationally – think of it as a friend guiding you through their notebook rather than a machine reading instructions.
Part 1 – Getting your environment ready
Before we write any code we need a comfortable working environment. Django projects live inside Python virtual environments; they keep dependencies isolated and prevent one project from polluting another. In the original Foodiegram notes this is described as “a tool to keep the dependencies required by different projects in separate places”.
Installing Python 3.5
If you’re on a Mac, you probably already have some version of Python installed, but it may not be the one you need. Download Python 3.5 from python.org and follow the installer. On Windows, download the Windows installer and make sure “Add Python to PATH” is ticked during installation.
Creating a virtual environment
Open your terminal (on macOS) or Command Prompt/PowerShell (on Windows) and install virtualenv
and virtualenvwrapper. The Foodiegram tutorial suggests doing this globally because virtualenvwrapper adds helpful commands like mkvirtualenv
and workon
On macOS:
pip install virtualenv
pip install virtualenvwrapper
Add the following lines to your shell’s startup file (usually ~/.bash_profile
or ~/.zshrc
). This defines where your environments live (WORKON_HOME
) and loads the wrapper functions:
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
Reload your shell (source ~/.bash_profile
) and create a virtual environment. In the original blog the author called their environment foodiegramapp
mkvirtualenv foodiegramapp
Once created, your prompt should show the environment name in parentheses. If you ever exit the environment (deactivate
), re‑activate it with workon foodiegramapp
.
Windows users: virtualenvwrapper
is a Unix shell script. For Windows there is a port called virtualenvwrapper‑win
maintained by David Marblevirtualenvwrapper.readthedocs.io. Install it with pip install virtualenvwrapper-win
and use the same commands (mkvirtualenv
and workon
) in Command Prompt. If you prefer PowerShell, there’s also a virtualenvwrapper‑powershell
packagevirtualenvwrapper.readthedocs.io.
Installing Django 1.10
Activate your environment and install the specific version of Django we’re targeting:
pip install Django==1.10
Run pip freeze
to confirm that Django 1.10 is installed.
Starting the project
Use django-admin
to generate a new project skeleton. The Django tutorial explains that startproject
creates a collection of settings and starter filesdocs.djangoproject.com. In our case we call the project foodiegram:
django-admin startproject foodiegram
The command creates a directory named foodiegram
containing another foodiegram
package plus a manage.py
script. This double‑nested structure is normal in Django; the outer folder is simply a container. If the duplication bothers you, you can rename the outer folder to something like root
as the original tutorial suggests.
Your project tree should look like this:
root/
├── foodiegram/ # the actual Python package with settings
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
├── manage.py # command‑line utility
Migrating the database and running the server
Make sure you’re inside the project’s root folder and run the initial migrations. Migrations create the default database tables using SQLite. The Foodiegram tutorial emphasises that running python manage.py migrate
imports the necessary models and creates db.sqlite3
.
python manage.py migrate
Now start the development server:
python manage.py runserver
Django will report that it has started the server at http://127.0.0.1:8000/
docs.djangoproject.com. Visit the address in your browser; you should see Django’s “Congratulations” page. Stop the server with Ctrl +C when you’re ready to move on.
Note for Windows users: usepy manage.py
instead ofpython manage.py
if multiple Python versions are installed.
At this point we have a working Django project inside its own environment. Let’s start building Foodiegram’s core features.