An all-chocolate website where users can contribute recipes and get recommendations for essential baking tools.
As a user, I would like to:
- find chocolate recipes in one website so I do bake recipes myself.
- submit my own recipes and other users can submit their own too.
- update my own recipes and other people's recipes.
- delete my own recipes and other people's recipes.
- easily view the website while I am baking and easily shift from mobile to desktop and vice versa.
- manouver through the website with ease.
- to buy baking tools recommended by the recipes.
As a seller, I would like to:
- showcase my baking products alongside with chocolate recipes.
- recommend products for every recipe in the website.
- sell baking tools to a target audience.
Since the main goal of this project is to create, read, edit and delete records from the Mongodb database, I did a basic design so the user can easily manouver around the website and to manipulate the data. I did as much as possible gave each route a separate page and a confirmation message that a deletion of an entry will be made.
-
Sidenavbar - For mobile view, users can navigate the website through the sidenavbar or the links in the footer.
-
Uniform cards - Users will have great ease scanning for reipes because of the uniformity of the layout of the recipe cards.
-
Page updates - Users are redirected to updated pages upon submission, revision or deletion of a recipe.
-
Form validation - Users will not be allowed to submit a form if a field is left blank or if the required input type is not met.
-
Modals - Modals are used to confirm a deletion of a recipe. During deletions, users can choose to either confirm and will be directed back to the updated All Recipes page or to cancel.
-
Randomized product recommendation - A random product will be recommended upon opening a whole recipe. I made this by using
-
Product links to Amazon - Since I did not include a product page, I linked the products to Amazon instead.
products=mongo.db.products.aggregate([{'$sample': {'size': 3}}])to randomly get 3 products from the collection. Then use Jinja for and if loop to pick one from the 3 products. Otherwise, Jinja will throw a "TypeError: object of type 'Cursor' has no len()".
{% for product in products %} {% if loop.index < 2 %} {% endif %} {% endfor %}
- User login - This project did not require a user login that is why I did not include it. Although, it would be optimal for websites like this to have a user login so not anyone can edit and delete data. This project is mainly for CRUD operations.
- Search option - I did not include a search option because my website is already narrowed down to one subject, CHOCOLATE, and the products I included were baking products mostly used with chocolates. A search option right now would be unnecessary.
- Product page - I did not include a product page because I want to focus on the CRUD operations for the recipes.
- Pagination - I will add pagination if the recipes begin to increase in number.
Here are the list of programming languages, technologies, libraries, frameworks and plugin used for this website:
- HTML
- CSS
- Bootstrap - used for navbars, grid, parallax, buttons, forms and card styling
- MaterializeCSS - used for additional styling and components like textarea and Modals
- Google Fonts - used for font-styles Playfair, Merriweather, Roboto
- Font Awesome - used for icons
- jQUery - used for eventhandling and animation
- Python 3.8.2 - used for building a connection between Mongodb database and Flask app
- Flask - used as the project's framework, Flask uses dependencies and store them in
requirements.txtto build environments. - Jinja - used for handling templates
- MongoDb Atlas - MongoDB cloud service used for making document database that stores JSON-like documents
- Heroku - used for hosting this project. Github cannot host Python project. Requires
requirements.txtandProcfile.
I used Google Developer tools to test different components
-
Website pages
- Pages are responsive on different screen breakpoints.
- There are no weirdly positioned elements.
- Pages are mobile adaptable.
-
Form validation
- Users are not allowed to submit a form without filling required input.
- Throws an error message.
- Placeholders guides the user to write the right input.
-
Modal
- Appears everytime to confirm an action was made either by submission or deletion of recipe.
- Redirects to the updated page.
-
Submit button
- Disabled until form is completed.
- does not allow submission of incomplete form
-
Product links
- opens in a new tab
-
HTML Validator Passed tests except for one document
- on
whole-recipefile,
Element div not allowed as child of element ul in this context. - on
-
Passed tests, no errors found
-
found one issue
'Trailing comma in arguments lists' is only available in ES8 (use 'esversion: 8'). -
Passed test, no errors found
- Google Chrome
- Mozilla Firefox
- Microsoft Edge
-
Samsung Galaxy Note 10 plus
-
Iphone 4
-
Iphone 8 plus
-
Samsung Note 9
-
Samsung Galaxy tab has some issue with parallax layout
I use Gitpod IDE extension to clone Github repositories quickly. But you can do this too locally or on your chosen IDE.
-
Clone or download the Zip from Github
-
Make a new directory:
$ mkdir directoryor change directory to where you want to clone the repository:
$ cd directory -
Paste the clone link
$ git clone https://github.com/loulunds/3rd_Milestone_Project.git -
Update the
requirements.txtfile if you need to used additional dependencies. Procfile is already included in the repo. These two are Heroku's requirement to build the app.pip3 freeze --local > requirements.txt
In this project you need to set up environment variables so you can keep your sensitive information safe like passwords. You can do this by:
-
Update the
env.pyand.gitignorefile on root directory.env.pyshould be typed in your.gitignorefile. -
In
env.pythere should be:import os os.environ["variable name"] = "value of variable"-
In this project, I used Mongodb Atlas database so you need to make an account there then use
"MONGO_URI"as variable and your MongoDB connection by going toOverviewof your Cluster and click connect and choose optionConnect your applicationand copy the link -
Paste the link in your "value of variable"
-
-
Add this to your
app.pyfilefrom os import path if path.exists("env.py") : import env -
Now you can add this to app.py and your sensitive information is safe
app.config["MONGO_URI"] = os.environ.get('MONGO_URI', 'mongodb://localhost')
This project is hosted in Heroku, to do that:
-
Create an app in Heroku
-
In your terminal, login to Heroku
heroku login -i -
Go to
deployand find the clone link:$ heroku git:clone -a <app-name> -
Before pushing, add variables to
Config Variablesoption in Heroku.<key> <value> MONGO_URI <your Mongo_URI link> IP 0.0.0.0 PORT 5000 SECRET_KEY <SECRETKEY> if you have -
if you have everything above
$ git push heroku master
- Google - for yummy chocolate recipes
Thanks to my mentor, Dick Vlaanderen and to the tutor and student care support personnels of Code Institute. Also, to the thousands of contributor in Slack and Slack Overflow.
This project is for educational purposes only.

