iscott
3/15/2019 - 3:59 AM

django_command_lines_cheatsheet.md

Run Server:

python3 manage.py runserver

Create DB:

createdb <dbname>

Make migrations:

python3 manage.py makemigrations

Migrate DB:

python3 manage.py migrate

Create a project:

django-admin startproject <projectname>

Create an app:

python3 manage.py startapp main_app

Run Django Shell:

python3 manage.py shell

Import models in shell:

from main_app.models import *

Shell commands:

c = Cat.objects.get(id=3)
Cat.objects.all()
Cat.objects.first()