Menu

Installing Django

Introduction

Let's get Django installed and create your first project.

Setup

# Create and activate a virtual environment
python3 -m venv django_env
source django_env/bin/activate  # Linux/Mac
# django_env\Scripts\activate   # Windows

# Install Django
pip install django

# Create a new project
django-admin startproject mysite
cd mysite

# Run the development server
python manage.py runserver
# Visit http://127.0.0.1:8000/

Project structure

mysite/
    manage.py          # Command-line utility
    mysite/
        __init__.py
        settings.py    # Project settings
        urls.py        # URL configuration
        wsgi.py        # WSGI entry point
        asgi.py        # ASGI entry point

Assignment

  1. Install Django in a virtual environment.
  2. Create your first Django project and verify the welcome page loads.
  3. Create your first Django app: python manage.py startapp pages

Support me!

I am a software engineer giving back to the community - my name is Musila Peter. Join me in empowering learners around the globe by supporting SaneGenius!