Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.