Elite Rides is an E-commerce store that specialises in die-cast models of luxury, high-end cars. As a Customer you are able to purchase a product and set up and online account. Guest checkout is also available. As the Store Admin, you can login from the store-front and edit the product details, and delele products too. Elite Rides is responsive which makes shopping possible on mobile and table devices.
- User Experience Design
- Strategy Plane
- Scope Plane
- Structure Plane
- Skeleton Plane
- Surface Plane
- Features
- SEO Optimisation
- Web Marketing Strategy
- Agile Project Management
- Testing
- Strip Integration
- Accessibility
- Technologies used
- Information Architecture
- Deployments and Database Setup
- Creating an external database using ElephantSQL
- Create a Heroku app to connect to the new database
- Set up the project to connect to new ElephantSQL database
- Confirm that the data was migrated to ElephantSQL database
- Deployment to Github
- Deployment to Production
- Heroku Deployment
- Final Deployment Process
- Use of env.py
- Amazon Web Services S3
- Credits and Borrowed Resources
- Future Features
I used the 5 Planes of UX to provide a conceptual framework.
User - Customers
Hobby enthusiasts, mainly adults who can make purchases online.Admin
E-Commerce Managers.Super Admin
Store Owner, E-Commerce Managers.
- To develop an
mvp (minimum viable product)
that allowsUsers
to navigate an online store and purchase a product. - The shopping experiecne must be simple in design and navigation.
Admins
will have a store-front login to manage product cataloge.Super Admins
can access the Django back-end to view and manages Order and Customer data.
- As a high-end car aficionado and collector, it's hard to find a site online that deals with only stylish, luxury models. Also, existing competitors don't stand out in the market and it's hard to find them online.
- I want to promote an exlusive presence and target a younger and modern audience.
- Make die-cast models attractive again. Not focusing on racing and classic cars.
- Keep content simple and easy to digest.
- Let the imagery and branding become more engaging.
https://fonts.google.com/
Jura was used due to it's luxury, modern look and feel. It's easy to read.
- Checkout functionality
- Account Profile and User Authentication
- CRUD Functionality
- Site Navigation
- Newsletter SignUp
- Stripe 3rd Party Payment Integration
- Search Functionality
- Order Confirmation Email
- SEO Optimisation
- Company Information Pages
- Accessibilty
- Product Detail Page
- Product Listing Page
- Triggered Customer Messaging
- Taxonomy: Category Tree
- Standard E-commerce store layout (Header, Footer, Homepage)
- Error Handling
- 404 Error Page
- Shipping Rate Logic
- Product Reviews
Customer
Homepage with hero text and a hero banner.Customer
Category Pages.Customer
Contact Us Form.Customer
Company Information Pages (About, T&Cs, Privacy Policy, Cookie Policy).Customer
Footer to include Social Media Links, Links to Company Info and Newsletter signup.Customer
Account Related Pages: Login, Register.Admin
Access to manage products with CRUD functionality.
- All CTA (Call to Action) buttons will change colour to let the customers know that the buttons are clickable.
- The
Customer
andAdmin
are notified for changes and major actions. - The
Customer
recieves an order email confirmation when checkout has successfully completed.
Using the MoSCoW prioritisation method to outline the importance of each requirement and what needs to be delivered in the MVP.
Requirements | Must Have | Should Have | Could Have | Won't Have |
---|---|---|---|---|
USP (Unique Selling Point) Carousel on Homepage | Y | - | - | - |
Checkout functionality | Y | - | - | - |
Role-Based Login and Registration | Y | - | - | - |
Restrict User access to Admin area | Y | - | - | - |
Admin CRUD Functionality | Y | - | - | - |
Site Navigation | Y | - | - | - |
Newsletter SignUp | Y | - | - | - |
Stripe 3rd Party Payment Integration | Y | - | - | - |
Search Functionality | Y | - | - | - |
Order Confirmation Email | Y | - | - | - |
SEO Optimisation | Y | - | - | - |
Company Information Pages | Y | - | - | - |
Accessibilty | Y | - | - | - |
Product Detail Page | Y | - | - | - |
Product Listing Page | Y | - | - | - |
Triggered Customer Messaging | Y | - | - | - |
Taxonomy: Category Tree | Y | - | - | - |
Standard E-commerce store layout (Header, Footer, Homepage) | Y | - | - | - |
Error Handling | Y | - | - | - |
404 Error Page | Y | - | - | - |
Responsive Design | Y | - | - | - |
Front-end messages to notify the user and admin of any changes. | Y | - | - | - |
CAPTCHA Function | - | Y | - | - |
Display Sale Price | - | Y | - | - |
Current login state reflected to the user | - | - | - | Y |
Hero Banner Carousel | - | - | - | Y |
Product Reviews | Y | - | - | - |
Product Image Carousel | - | - | - | Y |
Shipping Rate Logic | Y | - | - | - |
- Permitted access based on
Customer
, E-Commerce ManagerAdmin
andSuper Admin
Role:
Page Name | Customer | Admin | Super Admin |
---|---|---|---|
Home page | Y | Y | Y |
Login page | Y | Y | Y |
Registration page | Y | Y | Y |
Logout page | Y | Y | Y |
Admin: Model Management | N | Y | Y |
Product Page w/ Edit & Delete | N | Y | Y |
Checkout | Y | Y | Y |
Contact Us | Y | Y | Y |
-
White background.
-
Black text.
-
Hover States: Underline style.
-
Wireframes Examples:
- Customer Orders in the Admin
- Products and Categories in the Admin
- Customer Messages in the Admin
- Newsletter Subscribers in MailChimp
- Order Data is
captured
from the Checkout andstored
in the database.
- An
order confirmation email
is sent to theCustomer
when they have successfully completed checkout.
- Products and Categories can be
edited
andadded
from the admin area.
- Customer messages can be
viewed
andupdated
from the admin area.
Customers
canupdate
delivery information andview
order history in thier online profile.
Customers
can view acompleted order
with details.
Customers
cansubscribe to the newsletter
from the footer.
Prioritising design for mobiles makes sense as there are space limitations in devices with smaller screen sizes. I need to ensure that the key elements of the website are prominently displayed for anyone using those screens.
See the mobile wireframes here
Web visitors on Mobile contributes to approximately half of the overall web traffic. The number of mobile users has surpassed desktop users. As per Statcounter GlobalStats, overall mobile users continue to grow with a leading market share of 60.43% as compared to desktop users.
- Home Page link (Elites Rides Logo)
- Search bar
- My Account
- Shopping Bag
- Dropdown Navigation Menu
To satisfy an MPV and keeping the Navbar simple allows Customers to become familiar with the store more quickly.
- Mobile
- Desktop
- In Model Management, you can add a new product to the catalogue.
- Customers can see their Default Delivery Information and Order History.
- Can Edit Product Details directly from the Product Page.
- Can Delete the Product directly from the Product Page.
- I used the Bootstrap modal pop up to alert the Admin that they are about the delete the product from the catalogue.
- Once they click
Delete
, the product is deleted from theDatabase
django-allauth
is an integrated set of Django applications dealing with account authentication, registration, management, and third-party (social) account authentication. It is one of the most popular authentication modules due to its ability to handle both store and social logins.
- When the Customer registers for the first time, they are asked to
verify
their email address.
- An email is sent to the Customer asking them to confirm this with a confirmation link.
- When the Customer clicks on the link, they are directed back to the store to confirm once more.
- Finally, after confirmation, the Customer is then directed to the Sign In page. A
Toast message
tells the Customer that their email address was successfully confirmed. This means The Customer is now stored in thedatabase
.
To prevent unauthorised access to Admin functionality (Create, Update, Delte), restriction logic is in place to stop Customers accessing those areas.
- A
logged in Customer
is presented withToast Error Message
when trying to access Model Management URL:
- A
logged in Customer does not
have the ability toEdit
andDelete
from the Product pages:
In the views.py files for Product and Profile apps, I imported from django.contrib.auth.decorators
called login_required
Decorators are special functions that wrap around another function and return a new one with some additional functionality.
In the case of login_required
for example, wherever I use this decorator it will make Django first check whether the Customer is logged in before executing the view.
If the Customer is not logged in, it will redirect them to the Sign In page.
I added @login_required
on the line immediately above each view I want to decorate.
Bootstrap 4 is a free front-end framework for faster and easier web development. Bootstrap includes HTML and CSS based design templates for typography, forms, buttons, tables, navigation, modals, image carousels and many more. Bootstrap also gives you the ability to easily create responsive designs.
- Alert popups are used to
improve Customer user experience
. Alert popups give users clear feedback as a result of their actions and any server response. - 4 Toast Messages: Error, Info, Success and Warning.
- I set a display timer of 3 seconds, so after 3 seconds the message will close itself.
- A close 'X' icon is still on the toast so customers can manually close if they wish.
I used a carousel to help promote selling points for the store. The carousel will help me present more than one customer message in one confined space. Website real estate can be limited, especially on mobile devices. This is where carousels come in handy.
Guest Customers are able to navigate and purchase a product without signing up for a customer account. They don't have to sign in or save any information to website besides their email address.
The Guest Customer has the option to Create an Account at the Checkout Success Page.
Befenits of Guest Checkout
is that you can convert the Customer much quicker
, removing the friction for certain customers.
Logged In Customers are able write and submit a product reviews on the product page. An Admin has the ability to delete reviews from the front-end, if needed. All product reviews are saved to the database.
Product reviews are a powerful source of social proof
, which builds trust and confidence
in the brand. Adding reviews to your product pages can result in increased in revenue
, by attracting new customers.
- Customers are offered
Free Shipping
when they spend over £50. - The delivery fee threshold can be updated at code-level.
- The functionality
calculates the current Bag Total
and informs the Customer of how much they need to spend extra to qualify for free shipping.
I added a sort by product filter on the product listing page. This helps the Customer order the product by name, price, make, model and cateogry. This is another way to help boost conversion so the Customers can see what they want more quickly, and increase the chances of a purchase being made.
A 404 page, or error page, is the content the Customer sees when they try to reach a non-existent page on the site. It’s the page the server displays when it can’t find the URL requested by the customer.
404 errors can be frustrating for Customers, so the main purpose of a 404 page is to turn the potential negative user experience of encountering an error into a positive one.
I've added a link back to the all products
page so the Customer can restart their shopping journey.
I've added meta data
and a title
to the base.html page. This helps Search engines like Google when looking for matches based on what the user searches for.
I added a description
, keywords
and author
. Search Engines will display the title and description information in user's search results.
Social links contain the rel="noopener"
attribute, which tells search engines not to include these links when it looks at the search engine ranking for the site.
I've create a xml sitemap which is a file that lists a website’s important page urls, making sure that search engines can crawl, or navigate, through them. It also helps search engines understand the website structure. A sitemap file ensures search engines will crawl every essential page on your website. A sitemap can help speed up content discovery for search engines when they crawl and index the site.
I've added a robots.txt file which is a simple text file that tells search engines where they are not allowed to go on a website. It lists out any folders or files that will not be crawled or indexed by search engine spiders.
Having a robots.txt file shows that I have acknowledged that search engines are allowed on the site and that they may have free access to it.
For this reason, search engines take the existence of this file in my projects as a sign of quality, and so it improves the SEO ranking as a result.
Short-tail Keywords | Long-tail Keywords |
---|---|
diecast models | high end diecast cars |
diecast cars | toy car models |
luxury toy cars | |
british diecast models | |
italian diecast models | |
german diecast models | |
mercedes diecast models | |
ferrari diecast models | |
- | lamborghini diecast models |
- | bentely diecast models |
- | luxury diecast models |
- Who are your users?
- Hobby enthusiasts, mainly adults who can make purchases online.
- Which online platforms would you find lots of your users?
- I would find them on Social Media such as Facebook, Instagram, Twitter, YouTube.
- Also on online communities like Reddit.
- What do your users need? Could you meet that need with useful content? If yes, how could you best deliver that content to them?
- High quality imagery would be most attractive along with detailed product specifications.
- User Reivews would also boost consumer confidence, building on brand trust and loyalty.
- Would your business run sales or offer discounts? How do you think your users would most like to hear about these offers?
- I would run regular sale promotions during peak seasons.
- I could setup online voucher codes to be redeemed when purchasing online.
- The vouchers would be sent via email to customers that have opted in to recieve marketing.
- I can also get into influencer marketing where online content creators and influencers can promote the brand.
- What are the goals of your business?
- Main goal is to increase conversion.
- To build brand awareness.
- Build the subscriber list.
- Build social media awareness and keep customers talking about the brand.
- Which marketing strategies would offer the best ways to meet those goals?
- I would need to make sure the site is optimised for SEO for prominent search rankings.
- Keep active on social media channels posting regular content and help promote offers.
- Engage with users on social media and get feedback from customers.
- Would your business have a budget to spend on advertising? Or would it need to work with free or low cost options to market itself?
- For the fist year I would need to keep spending low in order to generate revenue.
- After collecting sales and web statistics, I can see where investements need to be made in order to build on business goals.
The main focus is the product content making sure the product page is attractive, and gives the customer what they need to see and know in a short timeframe.
Facebook is currently the most popular social media channel. Creating a Facebook business page allows me to target and engage with a wide audience. I can also grow my Elite Rides community, building brand loyalty and trust. I can chat with customers, get customer feedback on a paltform that is free/low cost.
Customers can sign up to Elite Rides Email Marketing
by providing there email address.
Here I am using MailChimp to capture the Customer emails
and manage the subscibers via the MailChimp admin
.
I used Jira Project Tracking Software to manage the backlog for the project. Jira Software is an agile project management tool that supports any agile methodology and I was able to plan, track, and manage the whole project in Jira.
I tested the site against the Acceptance Criteria in each Jira User Story.
Result | User Story | Summary | Acceptance Criteria |
---|---|---|---|
PASS | ER-56 | Product Reviews | - As a USER, I want to be able to see the reviews section and click the review button, so that I can write and submit a review. - As a logged out USER and ADMIN, I want to be directed to the login page, so that I can write and submit a review. - As a USER, I want to not see the Delete link under each review, so I that I cannot delete product reviews. - As an ADMIN, I want to see the Delete link under each review, so I that I can delete product reviews if I choose to. - As a SUPER ADMIN, I want to see the product reviews section in the django admin, so that I can manage/delete reviews. |
PASS | ER-55 | Toast Alert Messages for Customers and Admins | - As a Customer, I want to be able to see the success toast, so that I know I have successfully added a product to my shopping bag. - As a Customer, I want to be able to see the success toast, so that I know I have successfully updated a product to my shopping bag. - As a Customer, I want to be able to see the success toast, so that I know I have successfully placed an order. - As a Customer, I want to be able to see the error toast, so that I know there is a server error or something is wrong. |
PASS | ER-44 | Custom 404 Page | - As a Customer / Site User, I want to be able to see the 404 page, so that I know the certain url/page does not exist. |
PASS | ER-41 | Product Listing Page Template | - As a Site User, I want to be able to view products based category selection, so that I can narrow down my products of interest. |
PASS | ER-40 | Sort By Functionality | - As a Customer, I want to be able to Sort the list of available products, so that I can easily identify the best-priced and categorically sorted products. - As a Customer, I want to be able to sort a specific category of product, so that I can find the best-priced product in a specific category, or sort products in that category by name, make and model. - As a Customer, I want to be able to sort multiple categories or products simultaneously, so that I can find the best-priced products across broad categories, such as “british” or “italian“. - As a Customer, I want 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 want is available. |
PASS | ER-39 | Contact Us Form | - As a site user, I want to be able to link on the link in the top navigation, so that I can see the page and the contact form. - As a site user, I want to be able to fill out the form and submit my message, so that I can contact the company - As a site user, I want to be able see a success notification on the front-end, so that I know my contact form was submitted. - As an admin user, I want to be able see customer messages come through in the admin, so that I can respond to them. |
PASS | ER-37 | Terms & Conditions | - As a Site User, I want to be able to click on the Terms & Conditions link, so that I can view the page. |
PASS | ER-36 | Cookie Policy | - As a Site User, I want to be able to click on the Cookie Policy link, so that I can view the page. |
PASS | ER-35 | Privacy Policy | - As a Site User, I want to be able to click on the link in the nav and in the footer, so that I can view the page. |
PASS | ER-34 | About Us | - As a Site User, I want to be able to click on the link in the nav and in the footer, so that I can view the page. |
PASS | ER-33 | Checkout Overlay | - As a site user, I want to be able to see the loading screen when I make a payment, so that I can know that my payment is being processed. |
PASS | ER-29 | Stripe Payment Integration | - As a Registered and Guest User, I want to be able to checkout using Stripe payment gateway, so that I can make a purchase online on desktop and responsive devices. |
PASS | ER-28 | Checkout Page Template | - As a Guest User, I should not have to log in, so that I can checkout faster - As a Registered User, I want see my details, so that I can update my details if I wanted. |
PASS | ER-25 | Shopping Bag Page | - As a Site User, I want to be able to click on the bag icon in the header, so that I can be directed to the shopping bag page. - As a Site User, I want to be able to view Shopping Bag Content at line item level, so that I can see what products I am going to buy. - As a Site User that has a bag total under £50, I want to be able to see the delivery threshold message, so that I know how much left i can spend to get free delivery. - As a Site User that has a bag total over £50, I should not be able to see the delivery threshold message. |
PASS | ER-24 | Mini Shopping Bag in the Header | - As a Site User, I want to be able to see what products are in by bag and the bag total, so that I can stay on the current page. - As a Site User that has a bag total under £50, I want to be able to see the delivery threshold banner, so that I know how much left i can spend to get free delivery. - As a Site User that has a bag total over £50, I should not be able to see the delivery threshold banner. |
PASS | ER-23 | Taxonomy: Product Category Tree | - As a Site User, I want to be able to see the products categorised in the navigation, so that I can clearly browse products on offer based on the categories. - As an Admin User, I want to be able to the attributes in the admin, so that I can manage the product data. |
PASS | ER-22 | Site Navigation | - As a customer, I want to be able to view a specific category of products, so that I can quickly find products I’m interested in without having to search through all products. |
PASS | ER-21 | Install Summernote for Product Description | - As as Admin User, I want to be able to see and use Summernote Editor in the Admin, so that I can style and format the Product Description. - As a Site User, I want to be able to see a styled and formatted product description, so that I can read the product information clearly and easily in my web browser. |
PASS | ER-20 | Product Detail Page Template | - As a Site User, I want to be able to view a hi-res the product image and the ability to view fully on screen, so that I can see what I am purchasing. - As a Site User, I want to be able to read the title, description, price and label clearly, so that I can read the product information. - As a Site User, I want to be able to use the quantity selector, so that I can purchase more than one of the same product if want to. - As a Site User, I must not be able to use the quantity selector, to select minus quantity. - As a Site User, I want to be able to click on 'Add To Bag', so that I can add the product to my shopping bag. - As a Site User, I want to be able to click on 'Keep Browsing', so that I can go back to the main product page to look at other products. - As a Site User on responsive devices, I want to be able to view the product detail page, so that I can see the product information and interact with the page. |
PASS | ER-19 | Implement Site Footer | - As a Site User, I want to be able to view the footer with all the expected elements and links, so that I can interact with the site. - As a Site User on a responsive device I want to be able to view the footer and use the site links, so that I can interact with the site. |
PASS | ER-18 | Implement Site Header | - As a Site User, I want to be able to view the header with all the expected elements , so that I can interact with the site. - As a Site User on a responsive device I want to be able to view the burger menu dropdown and use the site links, so that I can interact with the site. |
PASS | ER-17 | Install Django AllAuth for User Registration and Authentication | - As a Site User, I want to Register for an account, so that I Have personal account and be able to view my profile. - As a Site User, I want to Login and Logout, so that I can access and secure my personal account. - As a Site User, I want to Reset my password in case I forget it, so that I can gain access to my personal account. - As a Site User, I want to Receive an email confirming I’ve registered, so that I can verify that my account registration was successful. |
I used the W3C CSS Validator to confirm there are no errors in the base.css
file and the checkout.css
file.
I used the W3C Markup HTML Validator to confirm there are no errors in the html pages:
Document checking completed. No errors or warnings to show.
Javascript files tested using https://jshint.com/
I added /*jshint esversion: 6 */
at the top of the js files which tells
JS hint to use es6 features so it won't warn about them.
Also, I used /*globals $:false */
to suppress jquery warnings.
File Name | Result | Notes |
---|---|---|
stripe_elements.js | PASS | One undefined variable Line 25 for Stripe . This is coming from another script for Stripe which we don't want to modify. |
countryfield.js | PASS |
- I used flake8 to validate Python code.
- All flags/errors from my .py updates/files have been removed.
- The only flags listed now are related to migrations, settings.py and vscode which do not need to be touched.
- Mobile
- Desktop
- Mobile
- Desktop
I realised that on the checkout success page, the grand total is calculating a little less.
For example, when I add a product with shipping cost, the Grand Total should be £14.25
but shows on the checkout success page as £14.24
The issue was in Checkout App > models.py
where I need to add a round() fucntion
to the grand_total and output the price with 2 decimal places.
When I try to remove an item from my bag, nothing happens. I checked the browser console and saw a 403 error.
In the Bag App > bag.html
I removed the csrfToken from var = data
by accident as I wanted to remove the size reference.
I added a test review in the django admin for a product. But the product review was not showing on the product detail page.
In the product_detail.html template I'm checking against the contents of eachProduct
, and I didn't set eachProduct
in the context
for your product_detail view.
After I added the context, the reivews were showing
context = {
'product': product,
'eachProduct': product,
'num_reviews': num_reviews,
}
I've been setting up reviews on the product details page and all seems to be working on the local environment (gitpod). However, after I deployed to Production and tried to open a product page on Prod, I got an error:
ProgrammingError at /products/12/ relation "products_reviews" does not exist LINE 1: SELECT COUNT(*) AS "__count" FROM "products_reviews" WHERE "...
After speaking to Tutor Support, it seems the error was to do with database migrations. The issue comes from the fact I was connected to two databases. Every migration I do will be to the local database, and not both databases. This means that if I do migrations and make updates, these errors come on the remote database.
What I had to do was carry out a few steps:
- First is to comment out the sql database and the if statement so I only access the remote Elephant SQL database:
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
# if 'DATABASE_URL' in os.environ:
# DATABASES = {
# 'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))
# }
# else:
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
DATABASES = {'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))}
- I had to import the env.py file into my settings.py file:
if os.path.exists("env.py"):
import env
- I ran migrations to the remote database.
python3 manage.py makemigrations
python3 manage.py migrate --plan
python3 manage.py migrate
This then resolved the issue.
Stripe is a PSP (Payment Service Provider) that lets business owners collect payments and transfer them directly to their own account instantly. It's a popular PSP as it's easy to customise, and allows for fast ans simple checkout for Customers.
Stipe is set up in Developer Mode. This means you can use Stripe Test payments to simulate a live purchase on the store.
Note: You can use test cards from any country, but if you want to test UK cards then use these:
Country | Number | Brand | Date | CVC | Postcode |
---|---|---|---|---|---|
United Kingdom (GB) | 4000008260000000 | Visa | Any future date | Any 3 digits | UK Postcode |
United Kingdom (GB) | 4000058260000005 | Visa (debit) | Any future date | Any 3 digits | UK Postcode |
United Kingdom (GB) | 5555558265554449 | Mastercard | Any future date | Any 3 digits | UK Postcode |
In the base template, I added Stripe's js script in the corejs block, eventhough I only technically need it on the checkout page.
Stripe recommends putting it in the base template so it'll be available on every page of the site
which allows some of their more advanced fraud detection features
to work.
As I was using Gitpod, I had to make the Stripe keys permanent to the workspaces page. Othwerwise I would have to keep adding them all the time if I had to create a new workspace.
I did this by going to the Gitpod workpsaces page > clicking the account icon in the upper right > go to settings > entering them there under the environment variables section.
Before we call out to Stripe, I need to disable both the card element and the submit button to prevent multiple submissions.
I setup Webhooks in Stripe to help capture the payment intent, in case the Customer somehow intentionally or accidentally closes the browser window after the payment is confirmed but before the form is submitted.
Each time an event occurs on Stripe such as a payment intent being created or a payment being completed, Stripe sends out what's called a Webhook that we can listen for.
Webhooks are like the signals django sends each time a model is saved or deleted.
Except that they're sent securely from Stripe to a checkout URL specified.
The Admin
can then verify that the purchase was made successfully in Stripe, eventhough the order was not captured in the Database. The Admin can then manually create the order on behalf of the Customer knowing that they have paid for it.
I used aria-label
attributes in the html templates to help disabled users on the front-end understand what the different elements are and their purpose.
I’ve used Symantic HTML markup which helps browsers to understand the context of the content, and also helps with the accessibility for users with impairments.
- Python 3.8.5: is the main language used to build the back-end.
- JS: for the Stripe elements.
- HTML: is markup language used to build the front-end templates.
- CSS: is styling language used adjust layout and front-end styles.
- Bulma: I've used the
.icon
class from another CSS framework similar to bootstrap called Bulma. This helps ensure that whenever I use font awesome icons, they will always stay perfectly centred, and have a consistent size unless I manually change it.
- Django: A high-level Python web framework for the app.
- Django AllAuth: is an integrated set of Django applications dealing with account authentication, registration and management.
- CrispyForms: An optimised way of rendering forms on the front-end in a very elegant and
DRY
way. - Summernote: A JavaScript library that helps you create WYSIWYG editors online. Used in the Django Admin under Products to
enrich product descriptions
. - Pillow: To manipulate and process images, Pillow provides tools that are similar to ones found in image processing software such as Photoshop.
- SQLite3: Local DBMS (Database Management System) to use in Gitpod to store all data.
- PostgreSQL by ElephantSQL: Production DBMS (Database Management System) to store all data on the live site.
- Github: hosting service for software development and version control using Git.
- Pip3: is the package manager to intstall Python modules and libraries.
- Gunicorn: "Green Unicorn" is a Python Web Server Gateway to translate HTTP Rquests for Python to understand.
- Spycopg2: PostgreSQL database adapter so I can manage the Database in Python.
- Heroku: the hosting service to host the app.
- VSCode: the IDE used to program the app.
- Chrome DevTools: used to identify any errors when being rendered in the browser.
- Font Awesome: used to source social icons to be used on the app.
- Lucid.app used to create the Database schema and Dataflow Diagram.
- W3C Validator: used to validate HTML5 code.
- W3C CSS validator: used to validate CSS code.
- flake8: was used to validate Python code.
- jshint.com: was used to validate Javascript Code
- Replit.com: to store versions of work-in-progress snippets and functions of code.
- Django Secret Key Generator to generate a new secret key for the Heroku app.
Below I have mapped the database and explain how the different entities are connected to each other:
- The minimum number of orders a User can have is zero orders.
- The maximum number of orders a User can have are many orders.
To show that we use the Zero or Many notation.
- A specific order can only be related to one Customer.
- There can be one (and only one) User to an Order
To show that we use the ‘One (and only one)’ notation.
- An Order can only exist if it has at least one product.
- Also, an Order can have many products as the User can purchase more than one product on the site.
To show that we use the One or Many notation.
- A single product can be part of no Order but a single product can also be a product in many Orders.
To show that we use the Zero or Many notation.
- Only one Category can be assigned to a product, and a product must live in a Category in order to view and navigate to the Product.
To show that we use the One (and only One) notation.
- Many products can live in one Category.
- Also, a Category can have no Products living in it.
To show that we use the Zero or Many notation.
- A single Review can only be about one and only one Product.
To show that we use the One (and only One) notation.
- A specific product can have zero or many reviews.
To show that we use the Zero or Many notation.
- A single Review can only be created by one and only one UserProfile.
To show that we use One (and only One) notation.
- A UserProfile can decide to write no Reviews or write many Reviews.
To show that we use the Zero or Many notation.
The database I have been using while building Elite Rides in Gitpod is only accessible within Gitpod. The deployed site on Heroku will not be able to access it. So, I had to create a new database that can be accessed by my Heroku app.
- Log in to ElephantSQL.com to access your dashboard.
- Click “Create New Instance”.
- Set up your plan.
- Give your plan a Name (this is commonly the name of the project)
- Select the Tiny Turtle (Free) plan
- You can leave the Tags field blank
- Select “Select Region”.
- Select the nearest data center to me.
- Then click “Review”.
- Check your details are correct and then click “Create instance”.
- Return to the ElephantSQL dashboard and click on the database instance name for this project.
- In the URL section, clicking the copy icon will copy the database URL to your clipboard.
- In Heroku, I clicked New to create a new app.
- Gave the app a name and selected the region closest to me. The I clicked Create app to confirm.
- Open the Settings tab.
- Under Config Var I added
DATABASE_URL
, and for the value, copied in thenew database url
from ElephantSQL.
- In the Gitpod terminal, I installed
dj_database_url
andpsycopg2
, both of these are needed to connect to your external database. - I updated the requirements.txt file with the newly installed packages
pip freeze > requirements.txt
. - In the settings.py file, I imported dj_database_url underneath the import for os.
import os
import dj_database_url
- In settings.py, at the DATABASES section, I updated it to the following code, so that the original connection to sqlite3 is commented out and I connect to the new ElephantSQL database instead. I pasted in the ElephantSQL database URL in the position indicated.
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
DATABASES = {
'default': dj_database_url.parse('your-database-url-here')
}
- In the terminal, I ran the showmigrations command to confirm I'm connected to the external database
python3 manage.py showmigrations
. - I migrated the database models to the new database
python3 manage.py migrate
. - I had to create a new superuser for your new database
python3 manage.py createsuperuser
.
- On the ElephantSQL page for your database, in the left side navigation, select “BROWSER”
- Click the Table queries button, select
auth_user
- When I clicked “Execute”, I should see the newly created superuser details displayed. This confirms the data tables have been created, and I can add data to the external database.
$ git add .
- Adding this to the editor terminal commits all the latest file changes.
The dot (.) at the end is what adds all files to the commit.
$ git commit -m “{Commit Details}”
- Pushes the latest changes to the GIT Repository.
-m
means "message" which is common practice to add so you and other developers know what changes were being made.
Once I verified and tested by changes, I then deploy the changes to Production.
$ git push
deploys the code to the GitHub and into the main branch of code which is connected to Production (the Live Public URL).
- To prevent exposing the database when I push to GitHub, I deleted it again from my settings.py. I used an
if statement
so that when our app is running on Heroku where the database URL environment variable will be defined, we connect to Postgres. Otherwise we connect to SQLite when working locally in Gitpod. If the database URL is in os.environ I'll get its value usingdj_database_url.parse
and use that as my database setting; otherwise, I'll use the default configuration.
if 'DATABASE_URL' in os.environ:
DATABASES = {
'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
- To now make my deployments to work on the first try, I need to install
gunicorn
, which will act as our webserverpip3 install gunicorn
, and freeze that into the requirements.txt file. - I created the
Procfile
at root directory level to tell Heroku to create a web dyno which will run gunicorn and serve my Django app. - I need to temporarily disable collectstatic by using
heroku config:set DISALBE-COLLECTSTATIC=1
so that Heroku won't try to collect staticfiles when I deploy. - I need to add the hostname of my Heroku app to ALLOWED_HOSTS in settings.py, and added
localhost
in here so that Gitpod will still work too.
ALLOWED_HOSTS = ['pp5-elite-rides.herokuapp.com', 'localhost']
- I need to create a new secret key for the Heroko app and add it to the Congif Vars in Heroku. I used an online Secret Key Generator tool.
- I setup
automatic deployments to Heroku
so when I$ git push
to Github, I also deploy to Heroku at the same time.
- Set DEBUG=False in settings.py.
- Delete DISABLE_COLLECTSTATIC from Config Vars in Heroku.
- Commit and push the changes to GitHub which deploys to Heroku.
I've used the env.py file to store secret keys and other senstive environment varaibles. This ensures that the project secret keys and variables are safe, out of version control, and not stored in Github.
I need a place to store our static files and images. For this, I'm using Amazon Web Services s3
which is a cloud-based storage service
that gives us a small piece of Amazon's infrastructure that I can use to store static files.
After setting up the s3 bucket, I have to create a user to access it.
I did this through another service called IAM
which stands for Identity and Access Management
.
The process here is first I create a group for our user to live in. Then create an access policy giving the group access to the s3 bucket we created. And finally, assign the user to the group so it can use the policy to access all our files.
In settings.py I added a key USE_AWS
which is set to true
.
This is so the settings file knows to use the AWS configuration when we deploy to Heroku.
I added another setting to settings.py called AWS_S3_OBJECT_PARAMETERS
.
This will tell the browser that it's okay to cache static files for a long time.
- Django admin how to show currency numbers in comma separated format
- What Is a Positional Argument in Python
- Python Docstrings
- Python round() Function
- How should I format a long url in a python comment and still be PEP8 compliant
- Build a Contact Form in Python Django
- Integrating Summernote WYSIWYG Editor in Django
- Colour Pallete
- What is CAPTCHA
- How to auto close an alert after few seconds with Bootstrap?
- Bootstrap Modal
- Django Secret Key Generator
- Favicon
- Sitemap.xml
- Insipred by the
Boutique Ado
andDjango Blog
Walkthrough Projects. - Special thanks to CI Tutor Support for their support and guidance.
- AllAuth
- Website Footer
- Product Detail Page
- Website Navigation
- Product Categorisation
- Mini Cart
- Cart Page
- Checkout Page
- About Us
- Privacy Policy
- Cookie Policy
- Contact Form
- Product Listing Page
- Filter and Sorting
- Code Refactoring
- Product Reviews
- CAPTCHA on the Contact Us form.
- Optimise My Profile section.
- Display Sale Price.
- Promo Code at Checkout.
- Alternative payment methods (PayPal, Amazon Pay).
- Customer Control over Marking Channel Opt In - GDPR Compliance.