This website was built to fulfill the requirements of the Code Institute Milestone 4 Project. It is an e-commerce site designed for the future La Fraschetta store owners, Natasha Buongiorno and Simone Ottaviani.
Using the principles of UX design, this fully responsive website was developed using HTML, CSS, Bootstrap, JavaScript, jQuery, Python, Django, and it uses a SQL database through PostgreSQL, allowing the store owners to easily add, edit or delete the products that they have to sell.
The website payment system uses a service called Stripe. At this stage, the stripe functionality is set up to only accept the test card details. You can find these details here.
- Languages Used
- Site Design
- Hosting
- Databases Platform and Cloud Storage
- Frameworks and Libraries
- Other Technologies
- Testing
Testing and Project Barrier Solutions
- As a Shopper:
- I wish to easily navigate the site so that I can have a good user experience.
- I wish to get visual feedback so that I see when an action has been completed.
- I wish to view all the products so that I can choose some to buy.
- I wish to search for a specific product or category so that I may find the item that I want.
- I wish to view full product information so that I can see the details of a specific product including the price, description, product rating and product image.
- I wish to easily see my bag total so that I can stick to my budget.
- As a Site User:
- I wish to create an account for future purchases so that I can view my order history and confirmations, and save my payment information.
- I wish to easily login or logout so that I can access my profile and manage my personal details.
- I wish to be able to request a password reset so that I can receive an email to reset my password incase I forget it.
- As a Registered User:
- I wish to be able to add my own reviews to products so that I may share my experience.
- I wish to be able to add products to my wishlist so that I can view those products later.
- I wish to be able to remove products from my wishlist so that my wishlist only consists of products I want to have saved.
- As a Shopper:
- I wish to be able to sort the list of available products so that I can sort relevant products alphabetically, by name or by price.
- I wish to be able to sort a category of products so that I can sort relevant products alphabetically, by name or by price.
- I wish to be able to search for a specific product by name or description so that I can quickly find items I'm interested in.
- I wish to be able to view a list of search results so that I can see if the product I want is available to purchase.
- I wish to be able to easily see what I've searched for and the number of results so that I can quickly decide whether the product I'm looking for is available.
- As a Shopper:
- I wish to buy products online as a guest so that I can checkout without having to create an account.
- I wish to easily add, update the quantity, or delete products in my bag so that I can adjust my purchase to fit my preferences before checkout.
- I wish to be able to easily enter my payment information so that I can have a smooth checkout experience.
- I wish to experience that my payment and personal information are secure so that I can be confident enough to provide the neccessary information to purchase products securely.
- I wish to view a summary of my order before completing my purchase so that I can check that I havn't made any mistakes.
- I wish to receive a confirmation email of my purchase so that I can be confident that the purchase has been made successfully and view my order details.
- As a Store Owner:
- I wish to be able to add a new product so that I can add new products to my store.
- I wish to be able to edit any product so that I can update the details of products.
- I wish to be able to delete any product so that I can remove old items from my store.
- The website uses the colours found in the Italian Flag for authenticity.
- The website uses two fonts from Google Fonts.
- The first one is called Suwannaphum, chosen for it's traditional (but not rigid) look. It has a fall back font of 'serif'.
- The second font is called Dancing Script, chosen to try incorporate the typical Italian humour and flare. It has a fall back of 'cursive'.
- The icons in the site were taken from font-awesome and used for their obvious meaning.
- The logo was designed and created by Natasha, designer, photographer, and future owner of La Fraschetta.
- The first image (on the home page) of the site was chosen as a background for the Title. It is a sunset view of a little town in Tuscany called 'San Giminiano'. This image was chosen as it captures the true essence and beauty of Italy, complete with Italian rooftops, a church, a fort, Vinyards, and hills.
- The images on the Our Story page are all of Natasha and Simone, future owners of La Fraschetta, taken by Natasha.
- Some of the product and category images are also photos taken by Natasha. All the rest of the product and category images were chosen from various sites offering royalty-free images, used as placeholders in order to fillful the requirements for this project. These images will eventually be replaced by real La Fraschetta store product images.
The wireframes for desktop, mobile and tablet for this project can be found below:
- Home
- Our Story
- Contact Us
- Sign Up
- Log In
- My Profile
- Wishlist
- Products and Categories
- Product and Reviews
- Shopping Cart
- Checkout
- Order Success
- Add Categories
- Add Products
While the project relied on these wireframes, there are some differences between the wireframes and the final product due to time constraints and change of mind for different/better UI.
-
Home
-
Navigation Bar
-
Footer
-
Our Story
-
View a List of Products
-
View a List of Categorized Products
-
View the number of ratings and average rating for each product on All Products and Categorized Products page
-
View Product Details and stock availibility
-
Add Products to Shopping Cart
-
Update quantity and delete Products from Shopping Cart
-
Make purchases of the products in the Shopping Cart
- If the payment fails, the user is directed back to the checkout form and is shown a message that the payment failed.
- If the payment succeeds, the user will be sent a confirmation email containing the full order details and order number. The user will be redirected to the checkout success page and a message will display, informing the user that the payment succeeded, containing the order details and order number.
- Ability for a registered user to save their details upon purchase for ease of future purchases
-
Profile
-
Register/Sign In
-
Sign Out
-
Email Verification
-
Wishlist (for the logged in user)
-
Diplay of Reviews with Username and the Date it was added, for each Product
-
Add Reviews (for the logged in user)
-
Store owner has the ability to add Categories
-
Store owner has the ability to add / edit and delete Products
-
Contact Form
-
404 Page Not Found
-
500 Internal Server Error
- A 'Confirm to delete' modal, allowing the site users to confirm deletion of a product from their shopping cart to avoid accidental deletion.
- The ability for a registered user to delete their account with a 'Confirm to delete' modal.
- The ability for the logged in user to edit and delete their review(s).
- The ability for the logged in user to Add To Wishlist and Remove From Wishlist from the Listed Products page.
- The ability for the store owner to edit and delete Categories.
- A 'Confirm to delete' modal, allowing the store owner to confirm deletion of a product.or category in order to avoid accidental deletion.
- Pagination
- Contact Page
The navigation bar changes depending on user status and screen size:
Nav Link | Logged Out | Logged In (User) | Logged In (Admin) |
---|---|---|---|
Logo (small screen) | ❌ | ❌ | ❌ |
Logo (large screen) | ✅ | ✅ | ✅ |
Home | ✅ | ✅ | ✅ |
Delicatessen with dropdown list of Categories | ✅ | ✅ | ✅ |
Our Story | ✅ | ✅ | ✅ |
Contact | ✅ | ✅ | ✅ |
Search Our Site | ✅ | ✅ | ✅ |
My Account | ✅ | ✅ | ✅ |
My Account dropdown - Login | ✅ | ❌ | ❌ |
My Account dropdown - Register | ✅ | ❌ | ❌ |
My Account dropdown - Profile | ❌ | ✅ | ✅ |
My Account dropdown - Log Out | ❌ | ✅ | ✅ |
My Account dropdown - Add Category | ❌ | ❌ | ✅ |
My Account dropdown - Add Product | ❌ | ❌ | ✅ |
Wishlist | ❌ | ✅ | ✅ |
Shopping Basket Icon | ✅ | ✅ | ✅ |
The diagram below illustrates the database structure used in this project.
- Font Awesome was used to add the icons.
- Coolers.co was used to generate the colour palette in the readme.
- Google Fonts was used to import the Suwannaphum and Dancing Script font used within the site.
- Favicon.io was used to generate a favicon for the site using the site's logo.
- GitHub is used to store the code for this project after being pushed from Git.
- Heroku was used to deploy the live site.
- SQlite is the SQL database engine provided by default as part of Django and used during development.
- Heroku Postgres is the SQL database service provided directly by Heroku for storing the site's data.
- Amazon AWS S3 was used to host this project's images and static files.
- Django was used as a Python web framework for its rapid development and clean, pragmatic design
- pip was used to install the required dependencies for this site.
- Django-countries was used for its pre-built country field containing all the valid country codes.
- Crispy forms was used to manage rendering behaviour and layout of Django forms.
- Gunicorn was used for WSGI HTTP Server to support deployment of Django application.
- Jinja was used to auto-populate the site with the contents of the database.
- Stripe.js library was used for handling Stripe payment objects.
- Bootstrap was used to create a beautiful, responsive website.
- jQuery was used to make the DOM traversal easier within the JavaScript.
- Git was used for version control by utilizing the Gitpod terminal to add and commit to Git and push to GitHub.
- drawSQL was used to design the schema of the relational database.
- Balsamiq was used to create the wireframes during the design process.
- Am I Responsive Design was used for the screenshot in this repository's README.md and TESTING.md.
- Google DevTools was used to check site responsiveness, and as a general debugger.
- Lighthouse was used to check the site's Performance, Accessibility, Best Practices, and SEO.
- Tinyjpg.com was used to compress the images.
- Gitpod was used as a virtual IDE workspace to build this site.
- W3C Markup Validation Service was used to test that the HTML is valid.
- W3C CSS Validation Service was used to test that the CSS is valid.
- JSHint was used to test that the JavaScript is valid.
- PEP8 was used to validate the python syntax.
- An IDE (such as GitPod or VSCode)
- Git, for version control
- GitHub account
- Python3
- pip, for Python package installation
- Heroku account
- AWS S3 account
- Stripe account
- Email account
Create a Heroku app, connect to Postgres database and deploy the app without static files.
-
Gitpod Local environment
KEY VALUE DEVELOPMENT True -
Create an env.py file in gitpod
import os os.environ["SECRET_KEY"] = "#YOUR_SECRET_KEY#" os.environ["STRIPE_PUBLIC_KEY"] = "#YOUR_STRIPE_PUBLIC_KEY#" os.environ["STRIPE_SECRET_KEY"] = "#YOUR_STRIPE_SECRET_KEY#" os.environ["DATABASE_URL"] = "#YOUR_DATABASE_URL#" os.environ["STRIPE_WH_SECRET"] = "#YOUR_STRIPE_WH_SECRET#" os.environ["AWS_SECRET_ACCESS_KEY"] = "#YOUR_AWS_SECRET_ACCESS_KEY#" os.environ["AWS_ACCESS_KEY_ID"] = "#YOUR_AWS_ACCESS_KEY_ID#" os.environ["USE_AWS"] = True os.environ["EMAIL_HOST_PASS"] = "#YOUR_EMAIL_APP_PASS_CODE#" os.environ["EMAIL_HOST_USER"] = "#YOUR_EMAIL_ADDRESS#"
-
To deploy this application on Heroku, Heroku needs to understand what dependencies are required, as well as which files to run for this project.
- Create a requirements file: in the terminal type the following command:
pip3 freeze --local > requirements.txt
- This file will hold a list of all dependencies required for this project.
- Create a procfile: in the terminal type the following command:
echo web: python run.py > Procfile
- Make sure there is no blank line after the contents of this file.
- Create a requirements file: in the terminal type the following command:
-
Commit and push these changes to GitHub.
-
Login or sign up to Heroku.
-
Select 'Create New App' in the top right of your dashboard.
-
Choose a unique app name, and select the region closest to you, then click 'Create App'.
-
Go to the 'Deploy' tab, find 'Deployment Method', and select 'GitHub'.
-
Find your GitHub repository, and click 'Connect'.
-
Navigate to the 'Settings' tab and click 'Reveal Config Vars'.
-
Enter key-value pairs that match those in your project files for the keys below:
KEY VALUE SECRET_KEY YOUR_SECRET_KEY STRIPE_PUBLIC_KEY YOUR_STRIPE_PUBLIC_KEY STRIPE_SECRET_KEY YOUR_STRIPE_SECRET_KEY DATABASE_URL YOUR_DATABASE_URL STRIPE_WH_SECRET YOUR_STRIPE_WH_SECRET AWS_SECRET_ACCESS_KEY YOUR_AWS_SECRET_ACCESS_KEY AWS_ACCESS_KEY_ID YOUR_AWS_ACCESS_KEY_ID USE_AWS YOUR_USE_AWS EMAIL_HOST_PASS YOUR_EMAIL_HOST_PASS EMAIL_HOST_USER YOUR_EMAIL_HOST_USER DISABLE_COLLECTSTATIC 1 (Add this variable temporarily) -
In Heroku, navigate to the 'Resources' tab, and add on 'Heroku Postgres' with the free plan.
-
Back up your current sqlite database:
- As this database was designed without fixtures, make sure manage.py file is connected to mysql database.
- Backup the current database for each of desired model and load it into a db.json file: in the terminal type the following command:
python3 manage.py dumpdata your_model_name > db.json
- Repeat this action for each model you wish to transfer to the postgres database (alternatively you can backup your whole database)
-
Load data from db.json file into postgres:
- Create a temporary variable in your environement named: DATABASE_URL with the value of the Postgres URL from Heroku
- Install the following packages and freeze the requirements: in the terminal type the following commands:
pip3 install dj_database_url
pip3 install psycopg2-binary
pip3 freeze > requirements.txt
- In la-fraschetta > settings.py, add
import dj_database_url
at top of the page - Connect your manage.py file to your postgres database
DATABASES = { 'default': dj_database_url.parse('DATABASE_URL') }
-
Load your data from the db.json file into postgres: in the terminal type the following command:
python3 manage.py loaddata <your_file>.json
- (if you have backed up several json files, repeat this action for each file)
-
Make migrations to start using PostgreSQL: in the terminal type the following commands:
python3 manage.py makemigrations
python3 manage.py migrate
-
Create a superuser to access the Django admin panel: in the terminal type the following command:
python3 manage.py createsuperuser
- then add a username and password in the terminal
-
Install the Heroku CLI and login: in the terminal type the following command:
heroku login
orheroku login -i
-
Remove
DISABLE_COLLECTSTATIC = 1
from your heroku config vars. -
Commit and push changes to GitHub.
-
Add the hostname of your Heroku app to 'ALLOWED HOSTS' in your settings.py file. This can be found in Heroku Settings > App Name.
-
Navigate to the 'Deploy' tab on your Heroku apps Dashboard, and click on 'Enable Automatic Deployment'.
-
Click open app to view the application in your browser, your app should display without any images and static files at this stage.
Create and connect an Amazon bucket for storing images and static files.
- Create a new bucket, give it a name, and choose the region closest to you.
- Go to 'Properties', turn on static website hosting, and type index.html and error.html for the index document & error document fields and save.
- Go to 'Permissions', and add the code block underneath this section into your CORS config to link Heroku and your S3 bucket.
- Go to the 'Permissions' tab and click on 'CORS configuration'.
- To link Heroku and your S3 bucket, paste in the following code into the area provided:
[
{
"AllowedHeaders": [
"Authorization"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]
- Still in the 'Permissions' tab, click 'Edit' on the 'Bucket Policy' and open the 'Policy Generator'.
- Use the following settings to setup the policy correctly:
- Type of Policy: 'S3 Bucket Policy'
- Principal: '*' to allow all principles
- Action: 'Get Object'
- Amazon Resource Name (ARN): Paste your Bucket ARN and add * at the and of your Bucket Resource key arn:aws:s3:::bucket_name/
- Click 'Save'
- Still in the 'Permissions' tab, go to the 'Access Control List', Set the list of objects permission for everyone under the 'Public Access' section.
- Click on the 'Services' tab on the top left of the page and search for 'IAM'.
- Go to 'User Groups', 'Create New Group', enter a name, and click 'Create'.
- Go to 'Policies', 'Create New Policy', 'JSON', 'Import Managed Policy', 'S3', 'AmazonS3FullAccess', 'Import'.
- Get your ARN from 'S3 Permissions', delete the
*
from 'Resource', and add the code block underneath this section into the area. - Click 'Next', 'Review', provide a name and description, and click 'Create Policy'.
- Go to 'User Groups', 'Find New Group', 'Permissions', 'Add Permissions', 'Attach Policies', find the policy you created, and click 'Add Permissions'.
- Go to 'Users', provide a name, and tick the checkbox beside 'Access key - Programmatic access'.
- Click 'Next', select the group you created in step 1, and click through to the end.
- Finally, click 'Create User', and download the CSV file, which will contain your
AWS_SECRET_ACCESS_KEY
and yourAWS_ACCESS_KEY_ID
. This is the only time that this CSV file will be available, so it's very important to download it at this stage.
"Resource": [
"{YOUR ARN}",
"{YOUR ARN}/*"
]
- Navigate to S3, you'll see that you have a 'static' folder with all your static files in it.
- Create a 'media' file in your S3 Bucket, click 'Upload'.
- Click 'Add Files', then add all your product images.
- Under 'Manage Public Permissions', select 'Grant Public Read Access'.
- Then click 'Upload'.
- Finally, attempt to log in to the site using the superuser details, then access the 'admin' panel on the live site, go to 'Email Addresses', and select Primary and Verified on the superuser email address.
- Login or Sign Up to GitHub.
- On GitHub, go to CarlaBuongiorno/la_fraschetta.
- In the top right, click "Fork".
- Log in to GitHub and locate the Repository for this site.
- Under the repository name, above the list of files, click "Code".
- Here you can either Clone or Download the repository.
- You should clone the repository using HTTPS, clicking on the icon to copy the link.
- Open Git Bash.
- Change the current working directory to the new location, where you want the cloned directory to be.
- Type
git clone
, and then paste the URL that was copied in Step 4.git clone https://github.com/CarlaBuongiorno/la_fraschetta.git
- Press Enter, and your local clone will be created.
Alternatively, if using Gitpod, you can click below to create your own workspace using this repository.
All testing and project barriers and solutions has been documented here - TESTING.md
- Code Institute was the main source of information used to create this project.
- A large amount of code came from the Code Institute, Boutique Ado Mini Project Walkthrough by Chris Zielinski.
- The core functionality of La Fraschetta is all taken from the Boutique Ado project.
- Stackoverflow for help figuring out django error codes, and searching for bug fixes.
- Django Documentation for helping me understand Django as a whole.
- Python Package Index for customizing a country list django-countries.
- Django Documentation for helping me understand model fields better, in particular Positive Integer for the stock count of a product to be integers above 0.
- Django Documentations for helping me understand averaging using Aggregation. This was specific to Average Product Ratings.
- My mentor, Tim Nelson, for helping me understand and guiding me in rendering the reviews details on the Product Details page.
- My mentor, Tim Nelson, for helping me understand and create the average ratings functionality and rendering the correct amount of stars on each product on the All Products page, then updating the average rating after a new review is added.
- My mentor, Tim Nelson, for helping me understand and create the functionality to render a heart on each Product on the All Product page based on if a user has it in their wishlist.
- CSS Tricks for creating the little triangle pointers on the toast messages.
- w3schools for creating cards with a hovering effect for the Categories section on the Home page.
- Django For Everybody - Full Python University Course for better understanding of Django framework.
- Bootstrap throughout the site, to create a beautiful, responsive site.
- CSS Tricks for keeping the footer at the bottom of the page.
- hover.css for making icons grow on hover.
-
The site logo was designed by Natasha Buongiorno for this site.
-
The hero image, categories - 'Desserts' and 'Prepared Meals', product - 'Tiramisu', and all images on the Our Story page were all photos taken by Natasha Buongiorno from Buongiorno Photography and have been provided by her as the future owner of this store.
-
Many images used in this site were obtained from Unsplash, Stock Free Images and Dreamstime.com. All of these sites are completely copyright-free. Below are all the photographers whose work are featured in this website:
-
-
Beverages
- Champagne - Photo by Mael BALLAND on Unsplash - Sauvignon Blanc - Photo by Brett Jordan on Unsplash
- Cabernet Sauvignon Merlot - Photo by Ceeces Travel on Unsplash
- Aperol - Photo by Mollie Sivaram on Unsplash
- Dory Merlot - Photo by Lucas Santos on Unsplash
- Perrier Sparkling Water - Photo by Mae Mu on Unsplash
- Peroni - Photo by Matheus Bardemaker on Unsplash
- Heineken - Photo by Alexander Cifuentes on Unsplash
- Disaronno - Photo by Ethan Rougon on Unsplash
- Coca Cola - Photo by Alex Vinogradov on Unsplash
-
Bread
- Baguette - Photo by Slashio Photography on Unsplash
- Pane con Pasta Madre - Photo by Mae Mu on Unsplash
- Pane Casareccio - Photo by Eduardo Alexandre on Unsplash
- Focaccia - Photo by Quin Engle on Unsplash
- Ciabatta Panini - Photo by Sergio Arze on Unsplash
- Ciabatta Loaf - Photo by Toa Heftiba on Unsplash
- Grissini - Photo by Slashio Photography on Unsplash - Pane con le Olive on Stock Free Images
-
Desserts
- Creme Patissiere - Photo by Bohdan Stocek on Unsplash
- Bomboloni - Photo by Karolina Kołodziejczak on Unsplash
- Cannoli - Photo by amirali mirhashemian on Unsplash
- Amaretti Biscotti - Photo by Quin Engle on Unsplash
- Assortment of Biscuits - Photo by Nina Plobner on Unsplash
- Panettone - Photo by Food Photographer | Jennifer Pallian on Unsplash
- Brioche - Photo by Mae Mu on Unsplash
-
Cheese & Dairy
- Asiago - Photo by Alexander Maasch on Unsplash
- Pecorino - Photo by Aliona Gumeniuk on Unsplash
- Gorgonzola - Photo by Michele Blackwell on Unsplash
- Parmigiano - Photo by Max Nayman on Unsplash
- Tomello - Photo by Adana Eisagholian on Unsplash
- Cream - Photo by Autumn Hassett on Unsplash
- Yoghurt - Photo by Visual Stories || Micheile on Unsplash
- Milk with Jug - Photo by Mary Skrynnikova on Unsplash
-
Cold Cuts
- Ham - Photo by Сергей Орловский on Unsplash
- Salami - Photo by Wesual Click on Unsplash
- Pancetta - Photo by Davey Gravy on Unsplash
- Prosciutto - Photo by Stephane Coudassot-Berducou on Unsplash
- Mortadella - Photo by Gancino on Stock Free Images
-
Condiments
- Herbs - Photo by Kevin Doran on Unsplash
- Pickled Olives in Jars - Photo by Elie Dib on Unsplash
- Spices - Photo by Diana Polekhina on Unsplash
- Honey - Photo by Roberta Sorge on Unsplash
- Olive Oil - Photo by Roberta Sorge on Unsplash
- Pickles - Photo by Mylightscapes on Dreamstime.com
-
Pasta & RIce
- Farfalle - Photo by Tina Dawson on Unsplash
- Linguine - Photo by Sheila Joy on Unsplash
- Spaghetti - Photo by Heather Gill on Unsplash
- Tortellini - Photo by Aknazar Arysbek on Unsplash
- Fusilli - Photo by Bozhin Karaivanov on Unsplash
- Penne - Photo by Markus Winkler on Unsplash
- Jar of Rice - Photo by Darío Méndez on Unsplash
- Bowl of Rice - Photo by Mgg Vitchakorn on Unsplash
-
Prepared Meals
- Pasta Frutti del Mare - Photo by Olayinka Babalola on Unsplash
- Farfalle alla Pesto - Photo by Eaters Collective on Unsplash
- Lasagne - Photo by maryam jahanmehr on Unsplash
- Pasta Vongole - Photo by Liubov Ilchuk on Unsplash
- Cheese Platter - Photo by Juliana Barquero on Unsplash
- Party Platter - Photo by Anto Meneghini on Unsplash
-
Categories Images
- Bread - Photo by James Harris on Unsplash
- Beverages - Photo by Sebastian Andersson on Unsplash
- Spices - Photo by Ratul Ghosh on Unsplash
- Pasta - Photo by Jakub Kapusnak on Unsplash
- Cold Cuts - Photo by Egor Myznik on Unsplash
- Cheese & Dairy - Photo byWaldemar Brandt on Unsplash
-
- The site slogan and Our Story page was written by Natasha Buongiorno.
- All Products and Categories details (names, descriptions, prices) were created by Luigina Argentin.
- Tutors and students of Code Institute and the Code Institute Slack Community for their helpfulness and assistance when needed.
- My sister (Natasha) and her husband (Simone) for giving me the opportunity to design and create the initial website for La Fraschetta, a Delicatessen in which they wish to open in the near future.
- My aunt (Luigina) for the time, effort, and love she put in to finding all the product and category images and writting the details for each, for this site.
- My family, my husband for his devoted support, and my 5 year old for his patience while mom spent much of her time and attention on a computer screen.
- Lastly, I would like to say a huge Thank You to my mentor, Tim Nelson, for all his assistance, feedback, support, and pure dedication to helping me succeed with this project. I am so blessed to have had Tim Nelson as my mentor at Code Institute.