Coder Social home page Coder Social logo

trallard / shef_codefirst_python Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 28.0 65.33 MB

Course materials for the Advanced Python course in Sheffield πŸ€–πŸ’ͺπŸΌπŸ‘©πŸ»β€πŸ’»

Home Page: http://bitsandchips.me/Shef_CodeFirst_Python/

Python 5.34% CSS 64.78% HTML 6.20% JavaScript 23.68%
python dev backend codefirstgirls

shef_codefirst_python's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

shef_codefirst_python's Issues

FAQ Section

As the course progresses, if there are enough questions all asking similar things, maybe we could maintain a course FAQ section as we go along? Thoughts?

Installathon

We are running an installathon session on 12th of October @Diamond

Please try to be there (confirm here your attendance)

Instructors: how to submit materials

Once you have chosen your sessions (see #3 ) the workflow will be as follow:

  • Decide if you need to create additional slides. If so the template is on the gh-pages branch of this repository. Detailed instructions are also found there
  • If you are creating support scripts/material please make a folder for your session in the master branch of this repository for this
  • Make sure all the additional material is well commented
  • Even though we all have write and push access to this repo, make sure that you create a pull request when adding your material and assign at least one instructor (whoever, not only me) so that we are aware that new content has been added

Remember we will be encouraging regular use of GitHub hence the adoption of a central material content

Sticky notes for on the fly feedback

On previous programming courses with my team we have used a 'sticky note' approach to identify those attendees that need help with something.

At the beginning of the course we give them two sticky notes (e.g. one green one red) and ask them to use them as follow: stick the green on to of their laptop if everything is ok and they have completed the 'assigned task' stick the red if they need help/are stuck. That way the instructors acting as helpers know who to help without distracting the main instructor or the class. Also if most of the girls are struggling the main instructor would be able to see this and allow for extra time, clarification, slowing down... etc

Thoughts????

Flask session plan

Here's a rough structure of how I'm thinking the session and a half should go:

Beginning of Session 3 and 4

  • Quickly go through my challenge of the week
  • Brief recap on contents covered from session 2/3

Session 3

Before we go into the technical details on how to use Flask, cover:

  • Why do we need/use a server?
    • A server is used so we can share our application with the world (over the Internet)
    • (Links to those who did the beginners course) I believe they used GitHub pages? Quickly explain
      that their (static) HTML pages are actually being served over the GitHub server, hence they can see their project publicly online.
    • A run through of what actually happens when we visit a website. This should be fairly high level which covers the request-response cycle. Include a diagram to help the explanation. The explanation should go along the lines of:
      • When we type in a web address in our browser, we are actually sending a (GET) request to a server running the website you want to visit;
      • Based on the address we typed, the server uses this information and sends back a response containing the relevant page's HTML to our browser;
      • Our browser processes the response HTML, along with any CSS and JavaScript, and renders out the pretty web pages that we see (this is typically when we see the page stops loading).
  • What is Flask? Why do we use it?
    • Flask is a framework - a set of code written by somebody else that we can re-use
    • It's better to use Flask's code rather than writing our own as the code handling requests and responses are actually quite complicated!
    • So, by re-using Flask's code, it deals with said complex tasks for us and allows us to jump straight to building the interesting parts of our application

Now, the technical part:

  • Live code together the very first, basic Flask app

    • Explain the code line by line as we type them together, HackIntyre style πŸ˜‰
    • It will do no more than just returning "Hello, #ShefCodeFirst students" or something when visiting "/"
    • Run the script with the usual python app.py command in the terminal (assuming we named our file app.py)
    • Visit localhost:5000 and they should be able to see "Hello, #ShefCodeFirst students" in their browser
    • Visit some random link like localhost:5000/ihf to show that it will lead to an error, since we haven't defined how to handle requests for ihf
  • Follow up with an example which takes a URL parameter (similar to "arguments" mentioned in Python). E.g. a function with @app.route("/<name>") above will capture "darren" in the variable name if localhost:5000/darren is typed in the browser

Ignore the part in the curriculum note which says that we need to control-c and restart our server. It's wrong. With debug=True, Flask restarts the server automatically when it detects code changes.

  • Set up a typical Flask app folder structure together

    • Each app should have a static folder where CSS, JavaScript and other resources (images, videos) are placed
    • It should also have a templates folder, where the HTML files go
  • Linking up a basic HTML template together

    • Instead of returning texts as in previous parts, return a HTML template instead using the render_template function
    • Access data passed through the render_template function from Python in the templates

Session 4

Picking up from where we left off from the previous session, before we dive into the technical details:

  • What is a template engine? Why do we use it?

    • Traditionally, web pages have been served as static HTML files - this is essentially what the girls learnt if they did the beginners course
    • However, it becomes tedious when each page has to be written from scratch even though there might be only be tiny changes. Templating helps to solve this as we already have the basic structure laid out. All that's left to do is for us to "fill the gap" with data coming in with the request.
    • Writing every HTML files by hand also becomes difficult when we don't know what the content are ahead of time. Facebook and Twitter are good examples where the feed is different for everyone depending who they are friends with/following etc...
  • Routing?

    • The process of binding an URL to a specific function which will handle the request
    • Flask uses relative URLs - this is usually the string inclusive of the first single slash.
    • Relative URLs are used so that they work in a consistent way no matter where the application is hosted
    • /hello therefore can be accessed by <hostname>:<port_number>/hello
  • POST requests

    • First, more on requests. In the last session, we said that when typing a web address in our browser, we are actually sending a GET request to the server running the website.
    • Problem with GET request: any extra data you send along are visible in the web address. This isn't very good when you are sending over sensitive data like your password to log in to Facebook!
    • To solve this problem, browsers send data to servers using a different kind of request known as a POST request

Now, the technical details:

  • Sending data from HTML template back to Python
    • Update the HTML template to include a form
      • Remember to import request from Flask!
    • Maybe show a demo of what happen when submitting data with a form using a GET request to clarify
    • Define another function which can handle the GET requests about to be sent by the form
    • Update form method to use POST
    • Update decorator ("magic function") above function to handle POST requests instead
      • In both cases, use the request.value convenience CombinedMultiDict from Flask to grab data from requests to ease confusion!
  • More usage of the Jinja2 HTML template
    • Show good practices like breaking down common HTML parts across all pages (headers/footers) of a typical website into separate template files?
    • Then use {% include "header.html" %} etc to load it into main page HTML template
    • Alternatively, seems to be recommended by the official Jinja2 guide, have a "base" template which basically contains the common bits (headers, footers etc) with blocks that can be replaced by page specific templates?

Social

Booked pizza at Interval Bar on the 7th of November. β™₯️ This can be changed but Lakshika and I agreed this would be a better date!

Collecting projects

This process needs to be done better this year because we have the ShefCodeFirst.com that showcases all of the previous work. Any suggestions on how we can improve this? The only thing I can think of is mentioning the project early on and making it an objective during a session to deploy their apps etc. onto Heroku.

Need bios

Could you please write down here a mini bio of your self for me to put in our site πŸ˜„ ???
It should contain:

  • Name
  • Title
  • Small bio /text about you
  • social media you want to add (Twitter, GitHub, linkedin, blog ...)

Just add it as a comment here

Also if you have a picture of yourself add it to the repo please!

Choose session to lead

We have 4 instructors now! so each should decide on 1-2 sessions to lead and prepare the material accordingly

Make sure the material is added here **before ** the sessions and assign a reviewer (another instructor not leading the session)

Introduction email

Due to the limited time we have to cover so much content, we thought that it may be a good idea to mention in the intro/welcome email to the girls that they should do the exercises up to a certain chapter in the LPTHW e-book before the first session.

I'll have a look through and decide what that certain chapter should be soon!

Main content and onboarding repo

Need to create main content on the course materials

  • Instructors: how to add/structure content
  • Students: how to use the course material, extra resources

Also need to create the super useful quick git sheet

Talks

Hi everyone,

I'd like to invite some quick talks to the classes. I know you'd rather crack on with the lessons but to switch it up a bit I think having talks once in a while would be good.

Some suggestions:

  • MedTech - To see what they can do with their skills that would impact the "real world"
  • HackSheffield - To empower them to attend some hackathons and apply their skills!
  • Start-Up Weekend (Someone from USE has approached me to ask if this can be organised before their next start-up weekend event in November either 1st or 8th of November!)

Confirmed:

  • 8th of November: Start-Up Weekend

Add course content

I will make sure to add the course content and display this as a GitBook as suggested by my buddy

This will ensure everything is online w/nice rendering

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.