Make sure you have installed python 3.x.x then install django 5.x on your windows OS.
pip install django
Check Django Version
There are few ways you can check Django version on version irrespective of your operating system. Using command prompt or terminal run the following command. Make sure your Python virtualenv is activated.
django-admin --version
If you are in python shell or python file, you can check django version with the following code
import django
print(django.get_version())
You can list all the python packages installed with their current versions with following command
pip list
Create Django 5 Project
django-admin startproject blogdemo && cd blogdemo
This is how to create a django 5 project and change the directory to project root directory.
Run the Django 5 Server
As soon as you run the Django 5 server, the django project create one folder (__pycache__) and a file (db.sqlite3) in the project.
And you also see a warning about unapplied migrations. This error message is showing because Django ships with builtin admin model.
Here is how to run the and run the django migration
python manage.py runserver
Django makemigrations & migrate
makemigrations command is run to create the models for the specific app and migrate is run to apply the models to the database; in other words – migrate is to create the tables structure on the database.
Now kill the running django server with CTRL + C and run the following command to apply the admin models.
python manage.py migrate
Let’s Create Django 5 Super User
Run the following command to create django super user and create a user name, password and add your email address to the super user account.
python manage.py createsuperuser
After creating django super user, you can login to django admin page with created username and password.
http://localhost:8000/admin
Let’s create Django 5 App
Difference between Django Project and Django App
Django Project: hold only configuration files and folder.
Django App: is like a module that is plug-able to the Django Project.
To create Django Project, run the following command.
python manage.py startapp blog