💻

Django Installation Guide for macOS

Aug 18, 2024

Installing Django on Mac OS

Introduction

  • Overview of the tutorial: Installing Django on macOS.

Step 1: Open Terminal

  • Launch the terminal application on your Mac.

Step 2: Check Python Installation

  • Run command: python or python3
  • Expected output: Python version message.
  • If not installed, download and install the latest version of Python.

Step 3: Exit Python

  • Use command: exit() to exit the Python shell.

Step 4: Navigate to Desktop

  • Use command: cd desktop
  • Create a new project directory:
    • Command: mkdir projects
    • Customizable directory name.

Step 5: Change Directory to Projects

  • Command: cd projects

Step 6: Create a Virtual Environment

  • Importance of virtual environments:
    • Isolate Django projects.
    • Prevent conflicts between different versions of libraries.
    • Good practice for project organization.
  • Command to create a virtual environment:
    • python3 -m venv V1
    • "V1" is a customizable name for the virtual environment.

Step 7: List Directory Contents

  • Command: ls to verify creation of the virtual environment.

Step 8: Change Directory to Virtual Environment

  • Command: cd V1

Step 9: Activate the Virtual Environment

  • Command to activate: source bin/activate
  • Activation confirmed with prefix in command prompt.

Step 10: Install Django

  • Command: pip install django
  • Wait for the installation to complete.

Step 11: Verify Django Installation

  • Command: django-admin
  • Expected output: instructions indicating successful installation.

Step 12: Create Django Projects

  • Use subcommands like startproject to create new Django projects.

Step 13: Deactivate Virtual Environment

  • Command: deactivate
  • Confirmation: absence of virtual environment prefix in command prompt.

Conclusion

  • Encouragement to subscribe for more tutorials.
  • Expression of hope that the tutorial was helpful.