DEV Community


Django 2 Cheat Sheet

lamhoanganh profile image Lam Hoang ・1 min read

Django Cheat Sheet tries to provide a basic reference for beginner and advanced developers, lower the entry barrier for newcomers, and help veterans refresh the old tricks. Full Django Cheat Sheet

Creating a virtual environment

We need to create a virtual env for our app to run in: More Here
Run this command in whatever folder you want to create your venv folder

python -m venv ./venv

Activate the virtualenv

# Mac/Linux
source ./venv/bin/activate

# Windows
venv\Scripts\activate.bat - May need to add full path (c:\users\....venv\Scripts\activate.bat)

Escape from venv


Check packages installed in that venv

pip freeze

Install Django

pip install django

Create your project

django-admin startproject PROJECTNAME

Run Server ( CTRL+C to stop

python runserver

Create an app

python startapp APPNAME

Create migrations

python makemigrations

Run migration

python migrate

Collect Static Files

python collectstatic


Editor guide
ale_jacques profile image
Alexandre Jacques


Just a little typo: python start app APPNAME should be startapp (no spaces).


lamhoanganh profile image
Lam Hoang Author

Thank Alexander. I fixed it :D