1970-01-01 00:00

basics is stored in .local/lib/python3.7/django/bin

create a project: startproject mysite

start server: python3 runserver

create app within a project: python3 startapp appname

migrate the model: python3 migrate

add myapp migrations: add 'myapp.apps.myappConfig' to mysite/ python3 makemigrations myapp python3 migrate

view migration 0001: python sqlmigrate myapp 0001

launch interactive shell: python shell


to add a view, we must first have a route routes are defined in files and are defined with django.urls.path() in the urlpatterns list

for an app subcomponent to the view, in the main site must provide a route to the app

each view should have an associated function in the urls path. this function takes a template and applies the necessary transformations by adding the specific data to that template. we do this by defining the context in the .py file and then adding the code to the .html file with {% %}


on creating a project we must migrate to create the database

models are created of fields, and each database is a class that extends the models.Model class from django.db

there are many sorts of Fields (as well as other variables within a model)


django has a rich api for querying models, these are only examples:

get all entries:


get the first entry: