Community-driven coverage of elementary OS — news, guides & forums
Dark abstract low-poly geometric landscape with layered triangular facets in deep navy, charcoal, and muted teal, illuminated by a soft electric-blue glow near the horizon

News roundups, tutorials, application guides, and forums — built by users, for users of the elegant Linux distribution.

elementary weekly
#20
Latest roundup · 18 Apr 2015
Freya Release
Final
Covered in weekly #19 & #20
Forum Topics
Active
Installation, customization & more

Setting up Python and Django on elementary OS for Aussie developers

Working from a corner table at a Brisbane café, ordering another flat white before the lunch rush, is a common scene for Australian developers who choose elementary OS as their daily driver. The Pantheon desktop feels calm and uncluttered, which suits the way many of us prefer to focus when juggling client work and side projects between meetings. Pairing that clean interface with a properly configured Python and Django stack turns the machine into a genuine production workshop rather than just a hobby box.

This walkthrough covers the practical steps to get from a fresh install to a working Django project, with notes on tooling that fits the elementary ecosystem. It assumes you are comfortable in a terminal, but nothing more advanced. Whether you are studying at a TAFE campus in Perth, freelancing from a share house in Fitzroy, or building an internal tool for a small business in Adelaide, the same foundation applies.

Preparing your elementary OS system

Before installing any language tooling, it pays to bring the operating system up to date. Open the Terminal app from the Applications menu and run the standard maintenance commands:

sudo apt update
sudo apt upgrade -y
sudo apt install -y build-essential software-properties-common curl wget git

The build-essential package pulls in the GNU C compiler and related tools that many Python wheels expect when no prebuilt binary is available for your system. software-properties-common lets you add PPAs later if you decide to grab a newer Python interpreter than what ships with your current elementary release. Installing curl, wget, and git at the same time saves a few minutes when you reach the version-control stage.

If you prefer graphical tools for the basics, AppCenter handles system updates automatically when notifications appear, but most Australian developers I know still drop into the terminal for serious package work. The Pantheon terminal is perfectly adequate, and you can keep it pinned to the dock for quick access during a long arvo of coding.

Installing Python the right way

elementary OS typically ships with a usable version of Python 3 already installed. You can confirm the version and location with python3 --version and which python3. For most Django work, that system interpreter is fine for trying things out, but it is generally cleaner to install your own copy so that operating system packages and your own projects do not collide.

Two approaches work well. The first is pyenv, which lets you keep multiple Python versions side by side and switch between them per directory. Install it from the pyenv-installer repository, then add the small block of shell config to your ~/.bashrc. The second is the deadsnakes PPA, which provides older and newer interpreters as system packages and is simpler if you only need one version.

Whichever path you pick, finish by installing pip and venv if they are not already present. A quick python3 -m venv --help will confirm whether the virtual environment module is available, and if pip is missing, sudo apt install python3-pip will sort it out. From this point forward, the system Python should mainly be used to bootstrap your tooling rather than as the home for your project libraries.

Isolating projects with virtual environments

Django projects have a habit of pulling in different versions of the same library over time. Without isolation, one project upgrading requests or celery will quietly break another. Virtual environments solve this by giving each project its own site-packages folder and its own copy of any command-line scripts.

Create a folder for your Django work, perhaps ~/Code/django-projects, and move into it. Then run:

python3 -m venv venv
source venv/bin/activate

Your prompt should now show the (venv) prefix. Anything you pip install from this point is captured inside that folder. When you move to a different project, deactivate with deactivate or simply close the terminal window. For larger setups, pipenv or poetry add a lockfile and dependency resolver on top of venv, which becomes handy once a project has more than a handful of moving parts.

A small Australian habit worth keeping: store your projects on the same drive as your backups. Many of us plug in a portable SSD or rely on the NBN-connected home server in the study, but it is easy to forget that venv folders contain hundreds of small files that can turn a slow backup into a painfully slow backup.

Getting Django up and running

With a virtual environment active, installing the framework itself is a single command:

pip install django

Check the version with django-admin --version. To create a new project named, for example, myau, run django-admin startproject myau . from inside your chosen project folder. The trailing dot prevents Django from nesting the configuration inside an extra directory, which most people find easier to manage.

Move into the new folder and apply the initial migrations so the bundled SQLite database is ready:

cd myau
python manage.py migrate
python manage.py runserver

Visit http://127.0.0.1:8000 in Epiphany or your browser of choice and the welcome page should appear. Before showing this off to anyone, edit settings.py and add your machine's IP address or hostname to the ALLOWED_HOSTS list. On Australian home networks, your local address is often something like 192.168.0.x, and you may want to test from a phone on the same Telstra or Aussie Broadband connection to see how the dev server behaves over Wi-Fi.

Picking a code editor that fits the Pantheon desktop

elementary OS is opinionated about visual consistency, so the editor you choose matters. Code - OSS is the easiest match, and it is available directly from AppCenter with the usual one-click install. It handles Python well out of the box, has decent Django template support through extensions, and looks at home on the Pantheon panel.

If you need a heavier tool, PyCharm Community Edition is downloadable as a flatpak from Flathub or as a tarball from JetBrains. The flatpak version integrates with the application menu and respects the system theme, which is a nice touch on elementary. For terminal-first developers, Neovim with the right plugin set is fast and reliable, especially on older hardware that struggles with Electron-based editors.

Long coding sessions into the evening are common when you are racing a deadline, and the warm colour temperature that elementary offers can really help with tired eyes. The how-to-configure-the-night-light-feature-in-elementary-os-for-better-sleep guide explains how to tune the schedule and intensity so the screen stays comfortable without ruining the colour grading on your CSS.

Databases and project configuration

SQLite is fine for tutorials and small sites, but most real Django work eventually moves to PostgreSQL. Install it with sudo apt install postgresql postgresql-contrib libpq-dev. The libpq-dev package gives psycopg2 the headers it needs when you run pip install psycopg2-binary inside your virtual environment.

PostgreSQL on elementary OS uses the standard pg_ctlcluster commands, but most developers just rely on sudo systemctl enable --now postgresql to start the service on boot. Create a database and a role for your project through sudo -u postgres createuser and createdb. Wire it up in settings.py by replacing the DATABASES block with a PostgreSQL configuration, keeping the password out of version control by reading it from an environment variable.

A python-decouple or django-environ library makes this tidy. Store secrets in a local .env file that is excluded from Git, and reference them in settings.py with os.environ.get("DATABASE_PASSWORD"). The pattern saves headaches when you eventually push the project to a cloud host, and it keeps any client credentials you receive on a freelance gig safely outside the repository.

Version control and backup habits

Git is almost always installed through the system package manager, but it is worth confirming the version and configuring your identity:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

For GitHub or GitLab access, generate an SSH key with ssh-keygen -t ed25519 -C "you@example.com" and add the public key to your account. The ed25519 algorithm is widely supported and gives you short, secure keys. Once that is done, a project becomes a one-liner: git init, git add ., git commit -m "Initial scaffold", and then push to a remote.

A solid .gitignore for Django should at minimum cover venv/, __pycache__/, *.sqlite3, .env, and any local settings.py overrides. Drop these in before your first commit so you do not accidentally publish a secret. Freelancers working with Sydney or Melbourne clients often get asked to push code into a private GitLab repository hosted in Australia for latency reasons, so having a clean history from day one saves a round of cleanup later.

A rhythm that works well in Australian conditions is to start the day with a quick git pull and a database migration, write code in Code - OSS, run the dev server in the integrated terminal, and finish the afternoon by committing in small logical chunks. Keep a notebook beside the keyboard for TODOs, since the Pantheon desktop does not interrupt you with notifications, which is exactly the kind of quiet environment Django development rewards. Over a week or two, the sequence becomes muscle memory, and the machine stops being something you are setting up and starts being something you are simply using.

Browse the News Archive
Latest Updates

From the elementary weekly series

Low-poly faceted abstract render in dark charcoal and electric blue tones, suggesting a news bulletin or announcement
elementary news

elementary weekly #20

The first week with the final Freya release — community reactions, tips, and early impressions gathered in one roundup.

Abstract low-poly geometric scene in midnight blue and soft cyan, conveying a live broadcast or event atmosphere
elementary news

elementary SPECIAL

A live Hangouts event with the elementary OS founders, held on 11 April 2015, discussing the Freya final release.

Low-poly faceted render in deep navy and muted teal with subtle amber highlights, suggesting a tutorial or guide
Tips and Tricks

Timeshift Guide

How to use Timeshift — the intuitive system restore utility for elementary OS — to recover from configuration mishaps.

Explore

Topics & Resources

Dive into guides, application recommendations, and community discussions covering every aspect of elementary OS.