Skip to content

Instantly share code, notes, and snippets.

@rca
Last active December 17, 2015 15:09
Show Gist options
  • Save rca/5629520 to your computer and use it in GitHub Desktop.
Save rca/5629520 to your computer and use it in GitHub Desktop.

Django is app-based

projects vs. apps

  • templates directory in apps
  • static directory in apps

python manage.py collectstatic

Django, by default on production, does not serve static assets

  • that's the webserver's job

Views

  • views handle logic
  • class-based views
    • you can define methods to handle differend HTTP methods

Templates

  • include vs. extend
  • blocks
  • very limited logic, by design

URLs

  • design your URLs
    • very flexible, but can get messy
  • use the url() pattern with the name= kwarg.
  • reference URLs by name in templates

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment