Python Learning Journal: Step 1

You’ve been creating your learning journal entries so far using a shared journal I have created for you. It’s time now to make your own version.

Tasks

You’ll be working in your pyramid-learning-journal repository in GitHub. Create an application scaffold for your learning journal application. Ensure that the repository also contains a good Python .gitignore file, an appropriate OSS license, and extend the existing README.md to encompass today’s work. Your mockups from last week will be at the same level as these files and your ini configuration files.

Once the basics are in place, create a new branch (step1) for today’s work. Do your work on this branch.

Using what you learned today, both in class and in your readings, accomplish the following tasks for your learning journal:

  • Copy (not move, copy) the HTML mockups you made into the templates directory and your CSS stylesheet into the static directory.

  • Create a directory called data in your learning_journal directory.

  • Create a new HTML file in your data directory, and write today’s learning journal entry in pure HTML in that file. It should follow the same style rules as the mockup for your HTML detail page.

  • Remove (not comment, remove) all of the existing code from your views/default.py file.

  • Create the following view callables (functions):
    • list_view: for the list of journal entries
    • detail_view: for a single journal entry
    • create_view: for creating a new view
    • update_view: for updating an existing view
  • Connect each of the above views to the following routes, with descriptive but concise route names:
    • /
    • /journal/{id:\d+}
    • /journal/new-entry
    • /journal/{id:\d+}/edit-entry
  • Your list view will serve up your home page mockup, with today’s journal entry being the top one. The title for each entry on the list must be a link.

  • Your detail view will serve up today’s journal entry, regardless of which id is provided to the route.

  • Your create view will serve up the mockup for creating a new entry (should be a page containing an appropriate HTML form). This form will not be functional.

  • Your update view will serve up the mockup for editing entries. Similar to the create view, the form for editing a post need not be functional.

  • Ensure that each page has a “Home” button visible that returns the viewer to the home page, and a “New Entry” button that allows the user to create new entries.

  • Your view callables are tested with a nice suite of unit tests. Don’t just check the status code of the response, check its content. Make sure that it’s returning exactly what you expect from the given view.

You are working with a partner to complete this application. Your partner will drive on your repository while you navigate. You will arrange a time to switch, so that you can drive on their repository while they navigate.

Try not to spend more than 3 hours at a time on one person’s repository. You have other assignments to handle with your time.

When your work for the day is done, deploy YOUR OWN SITE to Heroku. The directions for deploying a Pyramid app to Heroku are in today’s notes. Read them.

Make sure to include the URL to your Heroku deployment in your README.md file. Also make sure that your README.md documents the routes and views used and that any function you write is appropriately documented.

For form and style of your README.md, check this pre-written version of our in-class expense_tracker app. It doesn’t have to be exactly this way, but it’s definitely a good start.

Submitting Your work

When your work is done and your site is deployed, push all your work to your GitHub repo. Open a new pull request from the step1 branch to master. Submit the URL of that pull request to Canvas.

Finally, merge your pull request to prepare for the work in Python Learning Journal: Step 2

Use the comment feature in canvas to submit the following:

  • At least one well-formed question about the work you did for this assignment
  • At least one comment on what went well
  • At least one comment on what was particularly difficult or challenging