Developer: Mark Wilde
- Project Instructions
- Cookbook Information
- UX
- Features
- Technologies
- Database Schema
- Testing
- Deployment
- Installation
- Credits
Guidelines for project development:
- Create a web application that allows users to store and easily access cooking recipes
- Put some effort into designing a database schema based on recipes, and any other related properties and entities.
- Make sure to put some thought into the relationships between them, and use foreign keys to connect these pieces of data.
- Create the backend code and frontend form to allow users to add new recipes to the site. Create the backend code to group and summarize the recipes on the site, based on their attributes such as cuisine or country of origin etc. Create a frontend page to show this summary, and make the categories clickable to drill down into a filtered view based on that category.
- Create the backend code to retrieve a list of recipes.
- Create a detailed view for each recipes, that would just show all attributes for that recipe, and the full preparation instructions.
- Allow for editing and deleting of the recipe records, either on separate pages, or built into the list/detail pages.
- Optionally, you may choose to add basic user registration and authentication to the site.
- You should conduct and document tests to ensure that all of your website’s functionality works well.
- Write a README.md file for your project.
- Use Git & GitHub for version control.
- Deploy the final version of your code to a hosting platform such as Heroku.
- This app is for people who may be interesting in learning more about meat and dairy free Asian cuisine.
- The Cookbook was created with simplicity and ease of use in mind. Users can add, view, edit and delete their own recipes.
- Users can also view, edit and delete recipes of other users.
- With this in mind it is hoped users will personalize their cookbook, keeping the recipes they like best.
-
Development of the website adhered to a mobile first approach, it implements a simplistic design with minimal content.
-
The Materialize CSS framework underpins the project and was implemented as per convention.
-
Users are asked to register or login before being granted access to the website.
-
All pages share the same navbar and footer, though each page has a clear purpose and some unique functionality.
-
Soft colors were used throughout the website in an attempt to help users feel relaxed.
Several user stories were considered before development began:
- "I eat a plant-based diet and would like to visit a website with 100% vegan recipes."
- "I am interested in veganism and would like to visit a website that has a collection of plant-based recipes."
- "As a parent I want to encourage my children to eat fruits and vegetables, I would like to visit a website with healthy food options."
- "I live by myself and want to learn about making wholesome meals at home so I don't just order takeaway."
- "As a person who wants to improve their cooking skills, I'm looking for new recipes to try."
- "I currently eat an unhealthy diet and want access to recipes that are good for my health."
- "I want to be able to store all my favorite recipes online, with minimum fuss."
- "I want to edit and delete recipes."
- "I want to encourage my friends to consider eating less meat and dairy, and would like to be able to recommend a good recipe website to them."
Page | Description |
---|---|
Index | This is the landing page. It is a basic page with a background image, and a simple registration form and login form. |
Asian Cuisine | This page displays a welcome message and three courses cards(starter, Main, Dessert), click on a card to see it's recipe collection. All the recipe cards in the collection will be returned. Users can click on a card to view, edit or delete the recipe. If they choose to edit a recipe it will be stored in there personal collection and can be viewed in the My Recipes page. |
About | This page gives a brief description of the website's purpose and provides some navigation tips. |
My Recipes | This page displays the users collection of created recipes in a list from newest to oldest. Users can also view, edit and delete their recipes here. |
All Recipes | This page displays all recipes in the Cookbook. Users can click on a recipe card for full instructions on cooking time, ingredients etc. User can also edit or delete any recipe. If they choose to edit a recipe it will be stored in their personal collection and can be viewed in the My Recipes page. |
By Country | This page displays five country collection cards, click on a card to see all recipes in that countries collection. All the recipe cards in the countries collection will be returned. Users can click on a card to view, edit or delete the recipe. If they choose to edit a recipe it will be stored in there personal collection and can be viewed in the My Recipes page. |
Logout | Users can log out at any time and will be returned to the landing page. |
-
An option for users to upload an image which would display on their recipe card (has since been implemented).
-
A search bar so that users could search recipes by ingredients.
- Visual Studio Code
- The project was developed using the Visual Studio Code code editor.
-
- The project uses HTML to create the pages.
-
- The project uses CSS to style the pages.
-
- The project uses Materialize for styling and responsive design.
-
- The project uses Material Icons icons in it's forms.
-
- The project uses JQuery for responsiveness.
-
- The project uses JavaScript for responsiveness.
-
- The project uses Python to write the sites logic.
-
- The project uses the Flask micro web framework for the apps backend functionality.
-
- The project uses the Flask-PyMongo as per instructions.
-
- The project uses the MongoDB for the apps database.
{
"_id": {
"$oid": "5bb367d579c4182d22c1e738"
},
"country_name": "Vietnam",
"course_type": "Dessert",
"user_name": "Teresa May",
"recipe_name": "Banana, Tapioca and Coconut Pudding",
"recipe_description": "Great combination of sweet banana and chewy tapioca pearl in a rich coconut sauce.",
"preparation_time": "5 minutes",
"cooking_time": "30 minutes",
"total_time": "35 Minutes",
"servings": "8",
"ingredients": "\r\n\r\n 1kg of very ripe asian bananas.\r\n1/2 cup sugar.\r\n1 tsp kosher salt.\r\n5 cup water.\r\n1 package 3.5 OZ dried shredded Tapioca - Soaked.\r\n1/3 cup Tapioca pearls.\r\n1-1/2 can coconut milk (13.5 OZ can).\r\n1/4 to 1/3 cup white sugar.\r\n1/4 tsp kosher salt.\r\nVanilla sugar or 3 Pandan leaves washed and tied into a knot.",
"instructions": "Bring water and coconut milk to boil in a medium saucepan.\r\nAdd sugar, salt, tapioca.\r\nReduce heat to medium low, let it cook for about 30 minutes, stir frequently.\r\nStir in bananas, remove from heat and let stand for 15 minutes.\r\nNote: after you add the bananas, don\u2019t stir too much, it\u2019ll break up the fruit.\r\nServe hot, or chill for 3-4 hours.",
"tags": "banana tapioca coconut",
"allergens": "none",
"recipe_creator": "Teresa May",
"img_url": "https://img.taste.com.au/HAHYDv8F/w720-h480-cfill-q80/taste/2016/11/banana-coconut-tapioca-puddings-che-chuoi-33083-1.jpeg"
}
User Story Tests
- Verify that all recipes are vegan.
- Verify that there are several health conscious recipes.
- Verify that are several recipes which are simple to prepare.
- Verify that users can store their favorite recipes on the website.
- Verify that users would be happy to recommend the website to others interested in a plant-based diet.
- Verify that users can edit and delete recipes.
Manual Tests
- Open the app.
- Try to submit the empty register form and verify that an error message about the required fields appears.
- Try to submit the empty login form and verify that an error message about the required fields appears.
- Try to submit the login form without first registering and verify that an error message appears.
- For the registration form, verify a user receives a warning message if they enter a user name that has already been chosen by another user.
- For the login form, verify a user receives a warning message if they enter an incorrect user name and/or password.
- When a user successfully registers verify they are taken directly to the courses page and receive a welcome message.
- When a user successfully logs in verify they are taken directly to the courses page and receive a welcome message.
- Verify the link in the footer is functioning correctly.
- Click on the "Asian Cuisine" link, verify the Asian Cuisine page is loaded.
- Click on the "About" link, verify the about page is loaded.
- Click on the "My Recipes" link, verify the My Recipes page is loaded.
- Click on the "All Recipes" link, verify the All Recipes page is loaded.
- Click on the "By Country" link, verify the By Country page is loaded.
- Click on the "Logout" link, verify the user is logged out and taken to the index page.
- Verify the floating action button is displaying in the bottom left corner of all pages except the index page.
- Verify users are taken to the add recipe page when they click on the button.
- Verify cards display all recipe information stored in the database.
- Verify the view button is functioning correctly, when clicked users are taken to a full page view of the recipe.
- Verify the edit button is functioning correctly, when clicked users are taken to the edit recipe page.
- Verify the delete button is functioning correctly, when clicked the recipe is deleted.
- Verify the three course cards are displaying.
- Click on each card and verify a user is taken to that course type, for example, if a user clicks on the starters card a separate page will load and display all starter recipe cards in the collection.
- Verify all information is displaying as intended with no grammatical errors.
- Verify any recipe a user adds or edits is displayed here.
- Verify users are shown a picture of the recipe with the recipe name below.
- Verify users can view, edit or delete a recipe by clicking the buttons labeled same.
- Verify the full collection of recipe cards are displayed here.
- Verify the five country cards are displaying.
- Click on each card and verify a user is taken to the chosen country, for example, if a user clicks on the Thai card a separate page will load and display all Thai recipe cards in the collection.
- Verify that all intended fields are displaying and that each field should be filled by the user with none left blank.
- Verify a user will receive an error for any field that has not been filled.
- Verify the add recipe and edit recipe buttons are functioning correctly, and that the database has been updated when the forms are submitted.
Other
- Google chrome developer tools where used at every stage of production to isolate issues and improve mobile responsiveness.
- The app has been tested on various browsers, including Chrome, Firefox, Opera, and Safari.
- The app was tested across many screen sizes, from very small to very large.
- Some family members tested the app on their own devices and their recommendations, such as to include individual recipe images, were taken on board.
- It is displaying as intended across various devices and in different browsers.
- The author is not yet proficient in automated testing, and as such, was unable to adhere to a test driven development approach.
- There was an issue with the full screen background image on the landing page not taking up the full viewport on some smaller mobile screens. As a result, a media query was used to remove the background image on some smaller mobile screens.
- There was an issue hiding the app.configs for the mongo database. This issue remained unresolved and the app.configs are displayed in the app.py page.
- There were issues using pagination on the All Recipes page. As the page wasn't displaying correctly, the pagination functionality was removed.
The website has been deployed to Heroku and can be accessed here
Heroku Deployment
-
Create an Heroku account.
-
Create a new app 'flask-riddle' on heroku.com
-
Install Heroku CLI:
$ brew install heroku/brew/heroku
-
Login to heroku:
$ heroku login
-
Check app has been created by heroku:
$ heroku apps
-
Add heroku remote:
$ heroku git:remote -a flask-riddle
-
Add requirements.txt file:
$ sudo pip3 freeze --local > requirements.txt $ git add requirements.txt $ git commit -m " Added a requirements.txt" $ git push heroku master
-
Add Procfile (instructs heroku how start running the project):
$ echo web: python app.py > Procfile $ git add Procfile $ git commit -m 'Added Procfile' $ git push heroku master
-
Set up dynos:
$ heroku ps:scale web=1
-
Setup config variables on heroku dashboard:
- Go to settings and click on reveal config vars
- Set IP to 0.0.0.0
- Set PORT to 5000
-
Restart dynos:
- Navigate into the 'More' menu and select 'Restart all dynos' to update the apps settings.
-
Open app:
- Click on the 'Open app' button to view your heroku deployed app in the browser.
from the console type:
$ git clone https://github.com/markwilde33/CI-project-four
$ cd CI-project-four
$ pip3 install -r requirements.txt
$ python3 app.py
App available at http://127.0.0.1:5000/
The Html Fundamentals module, CSS Fundamentals module, Python Fundamentals module,Practical Python module and the Data Centric Development module were used for guidance.
- VeganHeaven was used for recipe information.
- VeganRicha was used for recipe information.
- Google Images was used for the cuisine pictures.
- I received inspiration for this project from Code Institute, The Net Ninja, Brad Traversy and Corey Schafer.