Django - Create Project

After successfully installed Python and Django, lets start creating a project, type following command to create project.

List of django admin commands:

django-admin

Create django project:

django-admin startproject project1

This will create a "project1" folder with some python files.

Type in command prompt: cd project1, Now Run server:

python manage.py runserver

Open Browers: type http://127.0.0.1:8000/ to check django installed and running successfully.

To change django server port

python manage.py runserver 4000

Django IDE - Visual Studio Code

Download Visual Studio Code from its official website: Visualstudio

After downloading, click setup file, and install it

To better use django in visual studio code intall extensions: python, django, django snippet, html css support

Create First App

In Visual Studio Code, open directory where your Djanto installed and type any one below command:

python manage.py startapp hello

If you check in window explorer, under scripts folder, you will see your project folder too with some files

init.py - Blank file for initialising variables
settings.py - Project settings like database connectivity, installed apps, templates, debug, timezone, etc
urls.py - Urls declaration, mapping
wsgi.py - Web Server Gateway Interface

manage.py - It is a command-line utility which allows us to interact with the project in various ways