How to Install and Run Django in Python 3.12 (2024 Update)
Django is a high-level web framework written in Python that encourages rapid development and clean, pragmatic design. In this tutorial, we will guide you on how to install and run Django in Python 3.12, the latest version as of 2024.
Step 1: Install Python 3.12
First, you need to install Python 3.12 on your system. You can download the latest version of Python from the official website here. Follow the installation instructions for your operating system.
Step 2: Install Django
Once you have Python 3.12 installed, open a terminal or command prompt and run the following command to install Django using pip:
pip install Django
This will download and install the latest version of Django on your system.
Step 3: Create a Django Project
To create a new Django project, run the following command in the terminal:
django-admin startproject myproject
Replace “myproject” with the name of your project. This will create a new Django project directory with the necessary files and folders.
Step 4: Run the Development Server
Change into the project directory by running the following command:
cd myproject
Then, start the Django development server by running:
python manage.py runserver
You should see a message indicating that the development server is running. Open a web browser and go to http://127.0.0.1:8000/ to see your Django project running.
Conclusion
Congratulations! You have successfully installed and run Django in Python 3.12. You can now start building your web applications using Django’s powerful features and tools.