Learning to create
Django is a web framework for perfectionists with deadlines.Using it you can create many cool projects. It was designed to make common web development tasks fast and easy.
In this article we gonna learn how to create a project in Django.It's so easy like a piece of cake to create a project in Django.
We must have Django installed in our system.Use below commands to install it:
pip install django
In order to see the version of Django type Python from your shell.Then at the python prompt ,try to import Django like this:
>> import django >> print(django.get_version()) 2.2
Django is installed,now Finally we can create the project. Create a new directory in which we will place our Django project.
mkdir DjangoFolder cd DjangoFolder
mkdir will create a new directory by name DjangoFolder and cd is used to move inside that folder using shell.
Now in shell type the following magical words:
django-admin startproject Project
and BOOM, it will create a Django project by name Project inside the DjangoFolder directory. The Project is the name of project we created,you can use any other name as you like.
The DjangoFolder directory structure will look something like this:
I told you, it's just a piece of cake to create project in Django,don't be afraid to read official documentations of Django. More informations are available in the docs.
Use cd command to move inside the Project directory,remember you are currently in DjangoFolder, we have to move inside Project directory to run the server.
Now use the following commands in order to run the server:
python manage.py runserver
Go to localhost:8000/ in the browser,here you will see a cool animation of rocket flying. Something like below picture:
Thanks for your valuable time,i appreciate your effort,keep learning and never stop. Feel free to place your doubts or comments.