Skip to content

From Request to Template: How webpages load in Sidekick

Nicholas Chera edited this page Feb 13, 2018 · 1 revision

Intro

Building a webpage in django requires working with lots of files. The process is complicated, but its complexity allows us to do some really cool stuff. Big-picture, we're in a client-server model dealing with request and response objects.

  1. User sends request: The user types sidekick.apu.edu in their browser and hits enter.

  2. Server receives request: The server receives the request, converts to https if need be, and then passes the request to Django.

  3. Django routes request: Django's routing system uses urls.py files to figure out which view function it should pass the request to.

  4. Application view function:
    The view function will use the parameters from the request to generate or collect the information needed to build a webpage. The view function is where you'll collect any data from the database that you'll need and assemble it together into a python dictionary that gets passed into the project view

  5. Authorize user: Check to make sure the user's credentials are valid. If not, redirect them to the signin page.

  6. Project view function: The project view function (sidekick/views.py) adds in the information necessary to load the content for each webpage (like the current MoD or the user's stars and badges). Every app view function should call this function to render templates or else vital context data will be missing.

  7. Django template: The template file specified by the application view function is loaded up with all the data accumulated in the Application and Project view functions. The Django Template Engine transforms the templates into the html, css, and javascript that gets returned to the user!

  8. Return response object

Current Contributers

Mattaniah Aytenfsu

Software Development Manager

insert bio here

Jordan Caradonna

Intern

insert bio here

Chad Ditter

Intern

insert bio here

Joshua Wood

Code Contributor

insert bio here

Clone this wiki locally