# Django is here :fire: Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source. so the web-backend by django is ~~hard~~ **easy** ## Before start Make sure you [add python to path](https://hackmd.io/@movy18x/H1UuX1LT5) before you work on django contact with me if you have any problem with previous steps on [Facebook](https://www.facebook.com/mustafa.alakedy) ## PIP one of the most important tools in python is [PIP](https://pip.pypa.io/en/stable/), it is the package installer for python > pip is already installed (because we add python to path in previous step) >if you want to check if pip installed write in **terminal** >```terminal=1 >pip --version >``` >and the output will be **the version of pip** :+1: ## Installing django ### Step-1: create an workspace: by creating folder in any place in the computer ### Step-2: open the folder in the terminal by : 1- open folder 2- replce directory of folder with cmd (like image below) 3- press Enter ![](https://i.imgur.com/Y6sJbxP.png) ### Step-3: Create virtual enviroment by running in terminal ```terminal=1 python -m venv venv source venv/bin/activate ``` after running this code line by line the virtual enviroment will be created and activated ### Step-4: install django in terminal by running ```terminal=1 pip install django ``` ### Step-5: create django-project in terminal by running ```terminal=1 django-admin startproject (name_of_project) . ``` ### Step-6: Create django-app in terminal by running ```terminal=1 python manage.py startapp (name_of_app) ``` --- :::info after doing all of the 6 steps the folder we have created in `first step` will have the files of django project ![](https://i.imgur.com/dCu9o1r.png) * the folder with name `app` is the application * the folder with name `config` is the project * the folder with name `venv` is the virtual enviroment * `manage.py` file created with every django project ::: --- ### Step-7: add the app_name in settings.py :::info open project by any editor ( [`VS code`](https://code.visualstudio.com/) , [`pycharm`](https://www.jetbrains.com/pycharm/)) ::: open config folder then open setting.py file ![](https://i.imgur.com/0wib6tL.png) search for installed apps in settings.py ![](https://i.imgur.com/31mngwu.png) add the app_name (app) to the installed apps ![](https://i.imgur.com/Er0uHUn.png) --- ### Step-8: create `templates` folder in `app` folder > open **app** folder and create folder inside it with name **templates** > > ![](https://i.imgur.com/8EJUFWA.png) >--- > inside **templates** folder create folder with the same name of app **(app)** > >![](https://i.imgur.com/XqWnKD9.png) :::info the folder with name `templates` will have all the html files that we will use in our peoject in this direction: `templates`/`app`/`html files` ![](https://i.imgur.com/GRxub58.png) ::: ### Final-step: urls > create **urls.py** file inside the app > > ![](https://i.imgur.com/7qUcF1c.png) > --- > go to **urls.py** in the **project folder (config)** > > ![](https://i.imgur.com/iRVlLxw.png) > --- > **Change the code from** > ```python=1 > from django.contrib import admin > from django.urls import path > >urlpatterns = [ > path('admin/', admin.site.urls), >] > ``` > **to:** >```python=1 > from django.contrib import admin > from django.urls import path, include > >urlpatterns = [ > path('admin/', admin.site.urls), > path('', include('app.urls')) >] > ``` :::success The project and evrey thing been ready to start :::