Install Django Development Environment On Ubuntu/Debian

Exported on 28-Aug-2021 15:01:18

Parameters

Name Type Script Reference Default Value Comment
s1 Linux / Unix Server s1
s1c Linux OS Credential s1c

1 - Update APT Repository

Updates APT Repository

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Update apt repositories
sudo apt -y update

2 - Install Python3 and Pip3

Installs Python 3 and latest PIP3 for Python package management

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install python3
sudo apt-get install -y python3 python3-pip

3 - Install Virtual ENV

Installs Virtual ENV For Environment Management

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install virtualenv
sudo pip3 install virtualenv

4 - Setup Virtual Environment

Creates a directory to store our Django application and sets up a virtual environment using Virtualenv

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Create django applications
mkdir django-apps
cd django-apps
virtualenv env

5 - Install Django

Downloads and Installs Django

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install Django
sudo pip3 install django

6 - Setup Django Project

Creates a Django project and starts the development server in a screen session. The screen session can be accessed by running the command: screen -x

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Create Django project
django-admin startproject mysite

# Install screen package
sudo apt -y install screen

# Configure screen to run in background
sudo echo "zombie xy" >> ~/.screenrc

# Start development server
cd mysite
python3 manage.py migrate
screen -d -m python3 manage.py runserver