Create First Project

Open the cmd prompt and navigate to the place you want your project to be created, then use this code

Django-admin startproject mypro

After navigate this command “mypro” folder automatically created at your destination folder and there structure were follows:

Here you can see that a file name “manage.py” another folder name “mypro” .let’s explore second folder.

Here you can find more 5 files in mypro.now we will briefly discuss all the file meanings.

Manage.py :This file is the part of project by using the file you can interact with the project via command line, get full list of command line press hit the this command

Python manage.py help

__init__.py: This file indicates to the compiler that mypro is a project.

setting.py: This file contains the whole setting of the project..

urls.py: This file creates the links and communicates with other apps.

wsgi.py: This file is used when a project is loaded for deployment or host.

Application: a project can have many apps, Every application has an objective and can be reused into another project,see it as module in your project

Creating a Apps: We will create file in” mypro” project

python manage.py startapp myapp

By using this command django create a folder name “myapp” that contain serverial file,

__init__.py : just make sure that python handle as application

admin.py: this file is allowed to make any changes and modifications in the admin file.

models.py : here contain all models of the application.

test.py : here test file allows your project for the test.

views.py : views handle all the activity of your request and response.

Register your application in Project Setting:

After coming on this stage you have told you project that this and this are you application,so you have to register your application in INSTALLED_APPS in project setting lets understand by the snapshot.

Before the runserver has to migrate the project and given security password to project.

Now we will run the createsuperuser

Now we will runserver by : python manage.py runserver

Now go to browser type link in address bar:
Localhost:8000 or 127.0.0.1:8000/

Now login into admin page: localhost:8000/admin

Once connected with your superuser account, you will see the following screen −

Subscribe Now