Django Installation
Django Installation
Installation
Learning Objectives
• Install Python
• Setup virtual environments
• Install Django
Integrated Development
Environment (IDE)
Install Python
• Django requires
Python
• Options
• Your OS package
manager
• https://
www.python.org/
downloads/
Is Python Installed?
Is Python Installed?
Install Python – Multiple Versions
Installed
• There can be multiple Python versions on a single
device
• If you installed Python 3.12 and 3.13 at different times (or via
different sources), the installer often keeps them both. That
way, scripts depending on a specific version (like python3.12)
still work.
• If not available:
• https://pip.pypa.io/en/
stable/installation/
pip
pip
pip
Pip: Package Installation Example
pip: requirements.txt
• pip freeze > requirements.txt
• Lists all packages and their versions for the current
environment.
• Saves the file to the current directory
• Comparison2,3
• virtualenv supports older Python versions and needs to be installed using
the pip command.
• py – m pip install virtualenv
• venv is only used with Python 3.3 or higher and is included in the Python
standard library, requiring no installation.
py –m pip install
Django
Install Django (FYI)
Install Django
Install Django
• A comparison of systemwide packages vs. packages in
virtual environment
Install Django (Using
requirements.txt)
• Creating a requirements file
• Default apps
• admin, auth, sessions, messages, staticfiles
Django URLs
• Precise mapping between URL patterns and your views.
Django ORM
• Django's ORM (Object-Relational Mapper) means
developers can define data models in Python and query
them via a dynamic API, but you can still write SQL if
needed.
Django Views
• Views are the business logic layer that receives web
requests and returns web responses.
Django Templates
• The presentation layer that displays information to the user. It is a text
file, typically HTML, that contains variables replaced with values when
the template is evaluated and built-in tags and filters that control the
logic of the template.
Creating a Django Project
Creating a Django Project
• django-admin startproject
hello_world .
Vs.
django-admin startproject
hello_world