My Profile Photo

Diksha


Hi, I'm Diksha. I build the parts of cloud platforms customers trust without thinking about them, now on Data Cloud at Salesforce, previously at Microsoft. One of 50 Google Anita Borg Scholars from Asia-Pacific (2016), and still in love with encouraging women in STEM. Off the laptop, I'm running or cycling around Hyderabad.


Key to most commonly used django shell commands

Listed below are some of the commonly used shell commands while developing web applications in Django:

  • Create a project:
 $ django-admin startproject <project_name> 
  • Create an application:
 $ python manage.py startapp <app_name> 
  • Run the development server:
 $ python manage.py runserver
  • Save changes to models:
 $ python manage.py makemigrations <app_name (optional)> 
  • Create tables in the database according to the database settings for apps in INSTALLED_APPS:
 $ python manage.py migrate
  • Print SQL script to debug changes:
 $ python manage.py sqlmigrate <app_name> 0001
  • Check for any problems in the project without making migrations or touching the database:
 $ python manage.py check
  • Open Django Python shell API:
 $ python manage.py shell
  • Create super user:
 $ python manage.py createsuperuser
  • Check Django version:
$ python -m django --version
  • Upgrade Django:
$ python -m django --version
  • Change the server’s port from the default port 8000
$ python manage.py runserver <port_number>
  • Change the server’s IP (example- show work on other computers on the network)
$ python manage.py runserver 0.0.0.0:<port_number>