Skip to content

Instantly share code, notes, and snippets.

@iscott
Last active March 15, 2019 04:01
Show Gist options
  • Save iscott/0bd2991698df7d91ebdd8d7448cd977a to your computer and use it in GitHub Desktop.
Save iscott/0bd2991698df7d91ebdd8d7448cd977a to your computer and use it in GitHub Desktop.

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