Django Essential Commands

Sadat Mahmud
0

 




Django Essential Commands

1️⃣ Project & App Management

django-admin startproject project_name
python manage.py startapp app_name

2️⃣ Running the Server

python manage.py runserver

3️⃣ Migrations & Database Setup

python manage.py makemigrations
python manage.py migrate

4️⃣ Superuser Creation (Admin Panel Login)

python manage.py createsuperuser

5️⃣ Checking Migrations

python manage.py showmigrations

6️⃣ Opening Database Shell

python manage.py dbshell

7️⃣ Running Django Shell

python manage.py shell

8️⃣ Collecting Static Files

python manage.py collectstatic

9️⃣ Checking Installed Django Version

python -m django --version

🔹 Fixing PowerShell Execution Policy Issues (For Windows Users)

By default, Windows PowerShell blocks script execution. To allow Django commands to run properly, use:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

This command temporarily allows script execution for the current session only. If you want to set the execution policy permanently, use:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

For an unrestricted policy (⚠ not recommended due to security risks):

Set-ExecutionPolicy Unrestricted

These commands ensure that you can smoothly work with Django projects in a Windows environment while maintaining security.

āĻāĻ•āϟি āĻŽāύ্āϤāĻŦ্āϝ āĻĒোāϏ্āϟ āĻ•āϰুāύ

0āĻŽāύ্āϤāĻŦ্āϝāϏāĻŽূāĻš

āĻāĻ•āϟি āĻŽāύ্āϤāĻŦ্āϝ āĻĒোāϏ্āϟ āĻ•āϰুāύ (0)