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.