Django Essential Commands

Sadat Mahmud
1 minute read
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)