Welcome to Django - 101
This is the basic how to create a Django project.
Why Django
It is an open-source project and Django is a full-stack web framework for Python, providing a more comprehensive solution than Flask. However, I aim to deploy a model rather than develop a full-stack product.
What do I do
at first, we install Python
if it is not available on our local computer.
pip install Django
if it is avail it shows a message below, other than it takes a few seconds
:)
It's time to create our project. Kudus !!!
Open a terminal and navigate to the directory where you want to create your project.
Run the following command to create a new Django project. Replace "myproject" with the desired name for your project:
django-admin startproject project_name
example:
django-admin startproject myproject
- Change into the project directory:
cd myproject
open the project with vs-code
and select git-bash as a terminal.
- Now, let's create a Django app. Apps are components within a project that handle specific functionalities. Run the following command to create an app. Replace "myapp" with the desired name for your app:
python manage.py startapp myapp
after run the command we can see myapp is inside the myproject
- Now we run our app
python manage.py runserver
After running this command we can see the output likes
if you see something in your picture number 3
your project is done.
Congratulations! You've just created a basic Django project with a simple app.
My next post will be how to see the output after creating the project. Till then stay tuned and learn together.
% connect with me on social %