How to Install Django on Windows – Easy Steps

Django is a popular web framework that is used for building scalable, secure, and dynamic web applications. It is easy to use, open source, and has a vibrant community. Installing Django on Windows can be done with a few simple steps.

Here are the most straightforward steps to install Django on Windows:

1- Install Python: Django requires Python to run. Download the latest version of Python from the official website https://www.python.org/downloads/ and install it. Be sure to add Python to the PATH environment variable during installation.

2- Install pip: Pip is a package manager for Python that makes it easy to install and manage Python libraries. To install pip, download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py and save it to your computer. Open a command prompt and navigate to the directory where you saved the file. Run the following command to install pip:

python get-pip.py

3. Install Django: Once you have pip installed, you can use it to install Django. Open a command prompt and run the following command:

pip install django

4. Verify Django Installation: After installation, verify that Django is installed correctly. Open a command prompt and run the following command:

django-admin --version

This command will display the installed version of Django.

Congratulations! You have successfully installed Django on your Windows system. Now, you can start building your web application using Django.

Creating your First Django Project:

After installing Django on your Windows system, you can run your Django web application on a web browser by following these steps:

1- Create a Django project: Open a command prompt and navigate to the directory where you want to create your Django project. Run the following command to create a new project:

django-admin startproject myproject

This command will create a new directory named ‘myproject’ in the current directory.

2. Create a Django app: A Django project consists of one or more apps. To create a new app within the project, navigate to the project directory using the command prompt and run the following command:

python manage.py startapp myapp

This command will create a new directory named ‘myapp’ in the project directory.

3. Run the development server: To start the development server, run the following command in the command prompt:

python manage.py runserver

This command will start the development server and display the URL of the application in the command prompt. By default, the server will run on port 8000.

4. Open the web browser: Open your web browser and navigate to the URL displayed in the command prompt e.g: http://localhost:8000 You should see the text “Hello, world!” displayed on the page.

Congratulations! You have successfully run your first Django web application on the web browser. You can now modify the view function and URL patterns to build your web application.

Leave you thoughts

Search Here

Free Python Course

Recent Blog