Skip to content

A collection of Django Project Templates for CS 1XA3 McMaster

Notifications You must be signed in to change notification settings

dalvescb/django_templates

Repository files navigation

django_templates

A collection of Django Project Templates for CS 1XA3 McMaster

Usage

  • See https://docs.anaconda.com/anaconda/install/ for info on how to Install Anaconda
  • All of the templates are meant to be run inside a conda environment that can be installed through environment.yml
    conda env create -f environment.yml
       # will create a new environment djangoenv
    conda info --envs
       # will show a list of available environments (djangoenv should be listed now)
  • This will install an environment named djangoenv on your system, remember to activate it with
    conda activate djangoenv
       # (djangoenv) should appear on the left of your shell prompt now
  • When you are finished you can deactivate with
    conda deactivate
       # (base) should return to the left of your shell prompt
  • Each template contains its own README.md that specifies how to run and recreate the template

Creating Your Own Project

  • I recommend you don't modify these templates, but rather recreate the parts of each template yourself, using the template and it's README.md as a reference
  • To create a new django project, make sure djangoenv is activated (see above), and use django-admin to create a new project
    django-admin startproject <proj_name>
      # creates a new project with the name <proj_name>

Templates Overview

  • simple_app template shows how to setup a simple as possible Django project with a single app that serves Hello World! (constructed in lab week09)
  • simple_server template shows how to serve html documents with static assets like javascript, and respond to basic http get/posts (constructed in lecture week09)
  • simple_ajax template shows two ways the client can update with the server
  • fancy_urls template contains examples of more sophisticated url manipulation, including capturing values from URLS, parsing regex expression based URL's, referencing URL's from templates, and redirecting to URL's from the server side (constructed in lecture week 10)
  • class_views template contains examples of more sophisticated url manipulation, including capturing values from URLS, parsing regex expression based URL's, referencing URL's from templates, and redirecting to URL's from the server side (constructed in lecture week 10)
  • simple_models template contains an example of how to create and run migrations on simple django models (i.e constructing a database). Note: it only goes over the preliminaries of how to use models (construct in lab week 11)
  • relational_models contains examples of models with a variety of different relations, and how to query and render them into a Django template. Used in lecture week 11
  • form_models contains examples of how to automatically generate Html Forms for Djano Templates from Django Models. Used in lab week 12
  • user_models contains examples of how to use the built in User Models, including peforming authentication lab week 12

About

A collection of Django Project Templates for CS 1XA3 McMaster

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published