frankiesanjana / bake-it-better

Bake It Better is a blog-style website for users to share baking recipes. The site has been created for the fourth portfolio project for Code Institute's Diploma in Full Stack Software Development.
0 stars 1 forks source link

Bake It Better

Bake It Better is a blog-style website for users to share baking recipes (generally referred to in this project as "bakes"). All users are able to browse bakes, and once users have created an account and signed in they can add, edit and delete their own.

Bake It Better has been developed using Agile methodology, and is written using Python + Django, HTML, CSS and Bootstrap. It is currently deployed via Heroku.

View the live project here.

The site has been created for the fourth portfolio project for Code Institute's Diploma in Full Stack Software Development.

View of Bake It Better display across a range of devices

User Experience

Personas

Following interviews with actual and potential users of baking recipes and websites, user personas were developed to guide the development of the site:

Toby

Man holding pastry

Toby bakes regularly when he has time, mostly to relax in between his busy and irregular work schedule. He has a number of staple bakes that he comes back to time and time again, but he is also interested in trying new recipes. He likes to keep fit, cycles to work or the gym most days and generally tries to eat pretty healthily, so he would be interested in a feature where he can save a baking recipe and come back to it when he can make a cake, cookies or pie to share with friends or family or take to a party rather than eating it all himself! He would be interested in features such as:

Dawn

Woman pouring cereal

Dawn doesn't bake much, but she would like to start. She enjoys watching baking shows to relax and unwind after work - she and her partner don't have much overlap in TV genres that they both enjoy, but they do both enjoy watching baking and cookery programmes together. She could see herself baking a birthday cake for herself or her partner, making bread for Sunday brunch or taking a day at the weekend to bake something more complex such as croissants or macarons. She would like to see the following in a baking site:

Fred

Man carefully building up layers of a cake

Fred loves to bake, whether that's for himself or his family and friends; he enjoys baking various different types of bread to have with a main meal, pancakes for a Sunday brunch, exquisite cakes or his favourite Yorkshire puddings, which remind him and his family of home since they no longer live in the UK. His bakes have been painstakingly honed over time; he has adjusted them over months or years to see what works best: a touch more butter in the mixture here, or five minutes longer in the oven there. His baking creations are always appreciated by everyone who gets to taste them, and he would like to publish his lovingly developed recipes on a website so that others can also reap the benefit of the time and effort he has put into creating and refining them. He would like a site that includes:

Beth

Woman with a child who is decorating a cake

Beth is retired and loves to spend time with her grandchildren. They often bake biscuits or cakes together since the kids can mix the dough and add icing and decorations at the end, but as they get older they are keen to try out some new bakes. Beth isn't sure what would be suitable but she would also find it more interesting if they could try out some new recipes together! When she has a whole day free, she also enjoys attempting new and more complex recipes herself and taking them to a family event or party, or keeping them for lunch with friends the next day. She would like to be able to:

User Stories and Owner Goals

Once I had developed the user personas above, considering their needs helped me to formulate a number of Epics:

These were then broken down into User Stories:

Site owner goals were also noted. These do not map to user stories but were nevertheless a consideration during development:

For more information about the Epics and User Stories and how the creation of the content for these took place, please see the Agile Development documentation of this project.

Design

The website was designed according to the five planes of content strategy. Using this structure provided a framework to develop the website. This is explained in more detail below.

Plane 1: Strategy

The strategy of the website is largely defined by the user and owner goals listed above in the User Experience section. The strategy is simply to provide solutions to the goals of the website's users and owners.

Plane 2: Scope and Features

The site includes the following features:

Header

Header image for non-signed-in user
Logo

I created a custom logo for the site using Hatchful. The logo is positioned to the top left of the navigation bar and resizes as the screen size is adjusted, so that it does not dominate smaller screens or appear too small to see on larger screens.

Navigation Bar

This appears on every page and includes links to the other pages.

Header image for signed-in user Navbar popout for signed-in user Header display on mobile devices

Footer

The footer is deliberately kept very simple so as not to detract from the main content of the site. It includes links out to Facebook, Instagram and Twitter:

Image showing footer of website

Homepage

Image showing welcome message and introduction Image showing homepage Image showing homepage with Edit & Delete buttons for author Image showing homepage with Edit & Delete buttons for admin user

Bake Detail page

Non-signed-in users
Image showing bake-detail page for non-signed-in user

and continues:

Image showing second part of bake-detail page for non-signed-in user
Signed-in users
Image showing bake-detail page for signed-in user Image showing star icon without stars Image showing user-starred star icon

For signed-in users, the comments section appears as follows, with any comments that have already been left first, followed by an invitation to leave a comment, a textbox in which to type a comment, and a Submit button:

Image showing second part of bake-detail page for signed-in user

User Account Pages

Sign Up
Image showing signup screen
Sign In
Image showing sign in screen
Sign Out
Image showing sign out screen
Success Message
Image showing success message

Add Bake Form

Image showing Add Bake form Image showing form without image Image showing form with image

Edit Bake Form

Image showing Edit Bake form

Delete Bake

Image showing Delete Bake form

My Starred Bakes Page

Image showing empty My Starred Bakes page Image showing My Starred Bakes page with bakes

Best For Bakes Plan

Image showing Best For Bakes page with placeholder cards Image showing Best For Bakes page with bakes and placeholder cards Image showing modal to add bake to Best For Bakes plan Image showing modal dropdown to add bake to Best For Bakes plan Image showing confirmation of adding bake to Best For Bakes plan

Custom Error Pages

Image showing 403 error page Image showing 404 error page

A number of features were identified that were desirable but were ultimately not within the scope of the project:

Plane 3: Structure and Data Model

The program uses Object Oriented Programming and Django's Class-Based Generic Views.

The user authentication system uses Django AllAuth.

The standard Django User model is used.

Custom models for Bake It Better are:

Database Schema

The structure of the database schema is detailed in the diagram below, which was created using Microsoft PowerPoint (click image to enlarge):

Image showing data model

Plane 4: Skeleton and Wireframes

Wireframes for the project can be seen below. These were developed on mobile, since due to the nature of the site and the way it is likely to be used, Bake It Better is very much a mobile-first site:

Image showing wireframes, first set


Image showing wireframes, second set


Image showing wireframes, third set

Plane 5: Surface

Colour Scheme

A simple colour scheme was developed using the Coolors colour palette, in combination with iterations of user testing and feedback. The intention was to provide an attractive background to the website without detracting from the content. Since the website has a relatively large number of media items and images can be uploaded by users, it was important to select neutral background colours that will fit well with a wide range of other colours.

The combination of the text and background colours used on the website have also been checked for sufficient contrast to ensure accessibility; for further details on this, please see the separate Testing documentation.

Typography

The Poppins font has been used for the main text in the body of the website; this is a simple font chosen for its ease of readability. The Lobster font has been used for headings. This is a slightly more artistic style of font intended to add a touch of style to the site. I was wary of choosing a font that was too complex or difficult to read and so user testing and feedback has been obtained to ensure that it remains sufficiently clear, including for one user who has dyslexia but assured me that they still found it both perfectly readable and aesthetically pleasing. The Sans Serif font is set as a backup in case the main fonts are not being imported correctly into the site.

Agile Methodology

For each sprint, the user stories for that sprint were added to the project board. Each user story is marked as belonging to its parent Epic, and has acceptance criteria that had to be met before it could be marked as complete. Associated developer tasks are listed below the acceptance criteria for each user story, and Story Points (an estimate made before work is begun that reflect the amount of work needed to complete a user story) have also been noted.

Further notes about the Agile development are described in the Agile documentation here and the user stories can be seen on the project board that was used to manage Agile development.

Testing

Security Features and Defensive Design

Database Security

The database URL, secret key and Cloudinary URL are stored in the env.py file to prevent any unwanted connections to the database. This was never pushed to GitHub and was set up before the first push to ensure security.

Cross-Site Request Forgery (CSRF) tokens were implemented on all forms throughout the site to protect against CSRF attacks.

User Authentication

Django's LoginRequiredMixin is used to ensure that any requests to access secure pages by non-authenticated users are redirected to the login page.

Django's UserPassesTestMixin is used to limit access based on certain permissions. It ensures that users can only edit / delete bakes for which they are the author, except for the admin user who is also able to perform these actions. If the user doesn't pass the test they will be shown an HTTP 403 Forbidden error page.

Form Validation

If invalid data is entered into a form or a compulsory field is left blank, the form will not submit. Warning messages will display to inform the user which field or fields need to be corrected.

Custom Error Pages

Custom error pages have been created to provide more information to the user if they encounter an error. The error pages also include links to enable the user to navigate back to the site. Error messages are as follows:

Technologies / Languages / Frameworks

Languages

Frameworks and Libraries

Other Technologies and Resources

Build & Deployment

Build

Create the repository

Image showing CI Gitpod template Image showing use this template button Image showing repo creation Image showing new repo with Gitpod button

Install Django and supporting libraries

Note that at the time this project is being created, Django 3.2 is the LTS (Long Term Support) version of Django and is therefore preferable to use over the newest beta Django 4.

Image showing server running popup Image showing success message

Deployment

Create a new external database

On elephantsql.com:

Image showing Elephant SQL Dashboard Image showing Create New Instance button Image showing Set Up Plan screen Image showing Select Region button Image showing Select Region screen Image showing Review button Image showing Confirm Create Instance screen & button Image showing dashboard with project Image showing project with link

Create the Heroku app

Image showing Heroku new app button Image showing Heroku new app data Image showing Heroku tabs Image showing Config Vars button on Heroku Image showing Config Vars on Heroku Image showing Add button on Heroku

Attach the Database

Get static and media files stored on Cloudinary

Image showing Cloudinary dashboard with API Environment variable Image showing code in settings.py for static files

Deploying to Heroku

Image showing buildpacks section in Heroku
- Select the Python buildpack and click "Save Changes":
Image showing available buildpacks in Heroku Image showing connected app in Heroku Image showing deployment options in Heroku

Forking this repository

It is possible to copy the repository in order to experiment with your own changes without affecting the original project. The steps to do this as as follows:

Cloning this repository

It is also possible to copy the repository onto your own local machine. In practice, this might be done to make it easier to fix merge conflicts, add or remove files, and push larger commits. To do this, follow these steps:

Picture of code button on GitHub

Credits

General Coding Skills

I made extensive use of various online resources to improve my understanding and knowledge before and during this project, including:

I also referred frequently to both the Hello Django and I Think Therefore I Blog tutorials on Code Institute

Specific to the Project

Coding

Firstly, thanks to the team at Code Institute Tutor Support for providing just the right level of help and hints to enable me to figure out answers for myself!

I used Code Institute's I Think Therefore I Blog walkthrough project to help me get started on this project. There are a few sections of code that are taken from the walkthrough project and remain relatively or completely unchanged. These are noted in the code and are also listed below:

A number of articles and blog posts were useful to help me for specifics of this project:

Other

Acknowledgements