My Profile Photo

Diksha


Hi, I am Diksha, currently exploring my developer instincts at Microsoft. I am one of the 50 recipients from Asia- Pacific of the Google Anita Borg Scholarship- 2016. I am involved with initiatives to encourage women in STEM. When I am not around my laptop, I love to spend my time running / cycling on the roads of 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>