Create Django Project

Creating a Django project involves a few simple steps. Here’s a guide to help you get started:

Step 1: Ensure Django is Installed

Make sure Django is installed on your system. Check by running:


python -m django --version
If Django is not installed, follow the URL

Step 2: Create a New Project

Run the following command to create a new Django project:


django-admin startproject project_name

Replace project_name with the name of your project like myproject.

This creates a directory named project_name containing the following structure:


project_name/
    manage.py
    project_name/
        __init__.py
        settings.py
        urls.py
        asgi.py
        wsgi.py

manage.py: A command-line utility for interacting with the project.

settings.py: Configuration settings for the project.

urls.py: URL declarations for routing.

asgi.py: Entry point for ASGI applications (for asynchronous features).

wsgi.py: Entry point for WSGI applications (for traditional web servers).

Step 3: Navigate to the Project Directory

Change to the project directory:


cd project_name

Step 4: Start the Development Server

Run the following command to start Django’s built-in development server:


python manage.py runserver

The server will start, and you’ll see output like this:


Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Open a web browser and go to:


http://127.0.0.1:8000/

You should see the default Django welcome page, which confirms that the project was created successfully.