Once you have installed django on your machine, you are ready to get started. In django
An application is a set of code files relying on the MVT pattern. As example let's say we want to build a website, the website is our project and, the forum, news, contact engine are applications. This structure makes it easier to move an application between projects since every application is independent.
$django-admin startproject project
$cd project
project$ tree
.
├── manage.py
└── project
├── asgi.py
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
1 directory, 6 file
manage.py
− This file is kind of your project local django-admin for interacting with your project via command line (start the development server, sync db...). To get a full list of command accessible via manage.py you can use the code__init__.py
− Just for python, treat this folder as package.settings.py
− As the name indicates, your project settings.urls.py
− All links of your project and the function to call. A kind of ToC of your project.wsgi.py
− If you need to deploy your project over WSGI.project$ python3 manage.py startapp app1
project$ tree
.
├── app1
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── migrations
│ ├ └── __init__.py
│ ├── models.py
│ ├── tests.py
│ └── views.py
├── manage.py
└── project
├── asgi.py
├── __init__.py
├── __pycache__
│ ├── __init__.cpython-36.pyc
│ └── settings.cpython-36.pyc
├── settings.py
├── urls.py
└── wsgi.py
4 directories, 15 files
project$ python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
March 27, 2022 - 02:24:18
Django version 3.2.12, using settings 'project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
If you want to run it on any other port
python3 manage.py runserver 9000
post by Pravin