Python / Django commands (unix)

Run these commands on the terminal.

Create a virtual environment first with the below-given command.

note:- the dot at the end means the current directory.

virtualenv -p python3 . 

Now activate the environment.

source bin/activate

To deactivate –

source bin/dactivate

Use these commands to check what all stuff has been installed in your virtual environment.

pip freeze

To install any package – 

pip install django==3.0.5

To create the project – startproject my_project .

To Run the server

python3 runserver

Next is to create an app, the command is –

python3 startapp my_app

To make a migration file

python makemigrations

To migrate to the database

python migrate


  • Models in python are a class which represent a table in a database
  • Each type of data we have (e.g Articles, Users) is represented by its own model
  • Each model maps to a single table in a database

ORM commands –

from Articles2.models import Articles




Admin page –

Reset the admin portal password.

First, create a new user

python3 createsuperuser


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s