#TimeToCook
TimeToCook is a place where you can find and add recipes. You can also save your favorite ones for easy access. Users can easily browse through list of recipes, each detailed with ingredients, step-by-step cooking instructions, preparation time, and user-submitted ratings to help you choose the best dish for any occasion.
- Index – Table of Contents
- User Experience (UX)
- Features
- Design
- Technologies Used
- Testing
- Deployment
- Credits
- Bugs
- Unfixed bugs
- Acknowledgements
-
-
- As a first time visitor, I want to see the most rated recipes.
- As a first time visitor, I want to be able to register on website.
- As a first time visitor, I want to be able to view recipe categories.
- As a first time visitor, I want to easily see website's features.
-
- As a returning visitor, I want to be able to log in to the website.
- As a returning visitor, I want to be able to add a recipe.
- As a returning visitor, I want to be able to edit my recipes.
- As a returning visitor, I want to be able to search through all the recipes.
- As a returning visitor, I want to be able to change my password.
- As a returning visitor, I want to be able to add recipes to favourite.
-
- As an administrator, I want to be able to manage categories.
- As an administrator, I want to be able to restrict access to users.
-
-
- The navigation bar allows users to quickly find recipes, save them to favorites, and access login and signup options. The account navigation button features a dropdown menu that displays certain pages only when the user is logged in.
- When the user is not logged in
- Once the user is logged in, their username will be displayed in the dropdown menu. Pages such as ‘Profile’, ‘Add Recipes’, ‘My Recipes’, and ‘Log Out’ will be visible.
-
- The index page consists of three card panels, each simply explaining the main features of the website.
- The index page features the top-rated recipes submitted by users. Only recipes with a rating of 4 or higher are shown. The picture and a short description of the recipe are displayed, including who added the recipe, its rating, difficulty, and category.
-
The ‘Add Recipes’ page is accessible after the user has logged in. It features an easy-to-use form that guides you through entering details such as the recipe’s title, ingredients, instructions, rating, and photo link for the recipe
-
As part of designing the site I decided to use purple, yellow and red as main colours. The pallete has been generated using coolors.co
-
Google Fonts were used to import Roboto into style.css
-
PostgreSQL is used as relational database using ElephantSQL as a host service
-
-
Home page desktop
Home page mobile -
Favourite Desktop
Favourite Mobile -
My Recipes Dekstop
My Recipes Mobile -
Categories Desktop
Categories Mobile -
Edit Categories Desktop
Edit Categories Mobile -
All Recipes Desktop
All Recipes Mobile -
Add Recipes Desktop
Add Recipes Mobile -
Manage Users Desktop
Manage Users Mobile -
Register Desktop
Register Mobile -
Log In Desktop
Log In Mobile -
View Recipe Desktop
View Recipe Mobile
-
Home page desktop
-
- Google Fonts: was used to import the 'Roboto' font into the style.css file
- Git: was used for version control by utilising VSCode terminal to commit to Git and Push to GitHub.
- GitHub: was used as the repository for the project's code after being pushed from Git.
- Visual Studio Code was used as IDE editor.
- Balsamiq: was used to create the wireframes.
- Flask: Micro web framework written in Python.
- ElephantSQL: PostgreSQL database hosting service for hosting website database.
- Materializecss: For making the website responsive.
- DbSchema: For creating the database schema logic and diagram.
-
For testing please refer to the TESTING.md
-
-
- Go to the GitHub repository
- Locate the Code button above the list of files and click it
- Select if you prefer to clone using HTTPS, SSH, or GitHub CLI and click the copy button to copy the URL to your clipboard
- Open Git Bash or Terminal
- Change the current working directory to the one where you want the cloned directory
- In your IDE Terminal, type the following command to clone my repository: "git clone https://github.com/mariusmilitaru32/TimeToCook.git".
-
By forking the GitHub Repository, we make a copy of the original repository on our GitHub account to view and/or make changes without affecting the original owner's repository. You can fork this repository by using the following steps:
- Log in to GitHub and locate the GitHub Repository
- At the top of the Repository (not top of page) just above the "Settings" Button on the menu, locate the "Fork" Button.
- Once clicked, you should now have a copy of the original repository in your own GitHub account!
-
- Go to ElephantSQL.com and select “Get a managed database today”.
- Choose the “TINY TURTLE” plan and click “Try now for FREE”.
- Log in with your GitHub account.
- Create a team with your name, agree to the Terms of Service, select Yes for GDPR, and provide your email.
- With your account set up, click on “Create New Instance” to start configuring your database.
- For the new database plan:
- Assign a Name to your plan, usually related to your project.
- Choose the Tiny Turtle (Free) plan.
- Leave the Tags section empty unless you have tags to add.
- Pick a data center location near you. For example, EU-West-1 (Ireland) might be a suitable choice.
- Click on "Review" to verify your selections.
- Confirm that the details are correct and then click “Create instance” to finalize the creation of your database.
- Go back to your ElephantSQL dashboard and select the instance name relevant to your project.
- In the URL section, use the copy icon to copy your database URL. Keep this URL handy as you'll need it shortly.
-
- Create requirements.txt and Procfile for Heroku deployment.
- Use "pip3 freeze --local > requirements.txt" to generate requirements
- Use "echo web: python run.py > Procfile" (replace run.py with your app’s main file). Ensure the Procfile has no trailing blank lines. Save, commit, and push these files to GitHub.
- Log in to Heroku.com, create a new app, and give it a unique name.
- Connect the app to your GitHub repository under the deployment section.
- In the settings tab, reveal config vars and add the environment variables used in env.py (IP, PORT, SECRET_KEY, DATABASE_URL, DEBUG). Make sure that DEBUG is removed in production enviroment.
- Enable automatic deploys and Heroku will start building the app.
- In the dashboard, select run console to set up the database tables on ElephantSQL by running
from timetocook import db db.create_all() exit()
- Create requirements.txt and Procfile for Heroku deployment.
-
- Stackoverflow for confirming the password and img url replace if invalid link is provided.
- The first bug I encountered was within the 'delete category' function; it caused a random category to be deleted instead of the selected one, which was due to an issue with the MaterializeCSS modal. To fix this bug I had to specify in the modal trigger href what category id should be deleted.
href="#modal{{category.id}}"
- The second bug I encountered was within the UserFavorite database model. When a recipe was deleted, it was not removed from the UserFavorite database. As a result, the app was crashing. To solve this bug, I had to create a relationship between the UserFavorite and Recipe database models.
recipe = db.relationship( "Recipe", backref=db.backref( "favorited_by", lazy="dynamic", cascade="all, delete-orphan" ), )
- The third bug I encountered was related to the recipe image. The issue lies in how the image is rendered, which is based on a user-supplied link, using the following img source attribute in Flask:
In cases where the link is not provided, or if the link is invalid and an image cannot be rendered, I have created a JavaScript script to replace with a website logo image.
<img src="{{ recipe.img_url or '../images/logo.png' }}" alt="recipeIMG">
- The unresolved bug is related to the image provided by the user. For example, if the user is simply typing text into the image URL field, the JavaScript replaces the missing image with a logo. However, I still receive a request in the Flask app, and the browser reports this as an error. I could't find a way to solve this request.
- Flask request
- Browser console
- The website logo is rendered fine
- Recipe URL
- I would like to thank Codeinstitute slack community for helping me during my studies and project creation.