Django Web Framework [Part-1]

Debapriya Basu
4 min readAug 5, 2023

--

Let’s start to learn about Python’s mostly used frameworks DJANGO. Let’s grab a coffee!☕️

Django is an open source web application written in Python to build large scale backend web applications. Work with Django you need a good knowledge of Databases, Python, Html, Css, new tools, development concepts and workflows.

Toolkit is a components needed for application development.

Dynamic website concepts

Developers use Django in below areas vastly.

Working with virtual environments on your local machine

While working with Django, you must first go to the local directory where you want to create your project and setup a virtual environment.

Ensure pip in installed on your device. The latest version can be installed and upgraded by using the command:

py -m pip install --upgrade pip -- For Windows
python3 -m pip install --user --upgrade pip -- For MAC

Python uses venv as the preferred module to create and manage virtual environments. venv is also included in the Python standard library and does not require any additional installation.

venv (for Python 3) and virtualenv (for Python 2) allow you to manage separate package installations for different projects.

In case you want to install virtualenv that is used for earlier versions of Python, use the command:

py -m pip install --user virtualenv  ---For Windows
python3 -m pip install --user virtualenv -- For MAC

You can create a virtual environment in the specific project directory by running a command:

py -m venv env  -- For Windows
python3 -m venv env -- For Mac

Note:

env is the name assigned to the virtual environment and this will create a virtual Python installation in the env folder.

Activate the virtual environment

Next you need to activate the virtual environment. You will put the virtual environment-specific python and pip executables into your shell’s PATH.

You can do this by running a command such as:

Exit the virtual environment

You can exit the virtual environment by running the command:

MacOS and Windows

deactivate

There may be OS specific difficulties you may encounter while installing and using virtual environments.

More information can be found on the official Python website.

Note: venv is not the only option available for creating virtual environments and other options exist such as pipenv which is another variation.

However, the use of venv is recommended.

To run and view your Django app in the browser, execute the following command in terminal. (Verify you are in the directory where manage.py file resides.)

python3 manage.py runserver # To run the server
python3 manage.py makemigrations # To compile the migrations
python3 manage.py migrate # To migrate the changes in Database

Additional resources

The following resources will be helpful as additional references when dealing with different concepts related to the topics you have covered in this course introduction.

Since this is a course exclusively about an open-source framework, there will also be a wide-scale reference to the official Django website and documentation.

Access the links below to explore more about Django.

Django official website

Django documentation

Installing VS Code on Mac — Official

Installing VS Code on Windows — Official

Django installation — Official

Install Django on Windows

Setting up Virtual environment in Python — venv (Windows and MacOS)

What’s Next

Next topics ⭐️👇

I will sum up few more topics which I found interesting to look at. Let’s get learning🍀!

🙏 Thank you for reading to the end! Comment below or email me at dbpr.sinha@gmail.com if you have any questions. For more articles please stay tuned. Also follow my links.

--

--

Debapriya Basu

Engineer @ IKEA group with product mindset and ready to take any challenges.