Giter Club home page Giter Club logo

django_project-1's Introduction

Luca D'Ettore

Ecommerce Application with User Authentication and Stripe Payments

This Web App was built as a final project for the Code Institute's classroom bootcamp. It is a fictional Ecommerce site built with Python's Django framework - no template was used.

Live Demo

Follow this link to view deployed version of the web app https://miguel-django-project.herokuapp.com/

Tech Used

Some the tech used includes:

  • HTML, CSS and Javascript
    • Base languages used to create website
  • Django
    • We use Django to handle page routing and to build custom directives
  • Bootstrap
    • We use Bootstrap to give our project a simple, responsive layout
  • Hover.css
    • use hover.css to obtain the underline in the navbar links
  • Google Fonts
    • use of google font "Luckiest Guy"
  • Font Awsome
    • Font Awsome has been used for the icons in all the pages

URL's

urls.py at the project level (topcommerce) gives the url patterns routes to views for the Apps that have their own urls, via the 'include' function:

from accounts import urls as accounts_urls

urlpatterns = [path('accounts/', include(accounts_urls))]

Views

Views called via URLs are Python functions that perform the different actions required to make the Website function e.g. render a template, log someone in, log them out etc.

Templates

The base.html page in the top-level templates folder is the base template used for all pages and includes all the links CSS/Bootstrap/Javascript etc. and the fully responsive navbar and footer that appears on all pages of the Website. It also contains:

{% block content %}
{% endblock content %}

Which allows other templates to be inserted in to that section (within the

section). Linking the base.html to templates within Apps:

{% extends 'base.html' %}

{% block content %}

All code for the app goes in here & will appear between the navbar & footer from base.html

{% endblock content %}

Apps

Accounts

The Accounts App is used for full user authentication. When users first visit the website they have two options under 'My Account' - Register if they have no account or Log In if they do. Once Registered/Logged in users can view their own profile that will display their username and email address they used to register with. Users can also visualise their shortlist of items(cart) and the option to log out once loged in. Seller registration functionality is included however it is not showing or used as the purpose of the website is for a manufacturer of watches to sell their own watches. Therefore the buyer model is the only one used.

Products

This App displays the Products that have been added via Django's admin panel. This App has the ability to search products with a simple Python function to search through all the products & render the products.html page which displays them.

Shortlist

The Cart App stores the quantity and price of all products selected and disaplays a basket total.

checkout

The checkout App renders the products of the shortlist App and a form for a one-off Stripe payment. Once paid there is a html confirmation and a text confirmation sent to the user.

Deployment / Hosting

This Project was deployed and is hosted on Heroku with automatic deploys from GitHub

Databases / Static Files

When running locally, SQLite database was used & static and media files were stored locally. When deploying, Heroku Postgres was used as the server database & an Amazon S3 bucket was set up to host all the static files. settings.py file was amended to base.py and local.py was created to handle the local resources while prod.py was created for the database & static files to point to the online resources.

Running the tests

Automated tests can be viewed in the tests.py file within the separate Apps. To run the tests, in your terminal navigate to the folder with your project in, activate your virtual environment and type:

$ python3 manage.py test <app name>

  • $ python3 manage.py test accounts - These will all PASS tests_forms.py in the Accounts App:

    1. Tests that the login form is valid with the correct detials
    2. Tests that the UserRegistrationForm validates properly when the correct information is supplied
    3. Tests that the registration form fails when one of the passwords has not been entered
    4. Tests that the registration form fails when the passwords do not match tests_models.py in the Accounts App:
    5. Tests that the buyer and seller model is correct
  • $ python3 manage.py test products - This will PASS tests.py in the Products App:

    1. Tests that the product name label is functioning correctly
  • $ python3 manage.py test shortlist - These will PASS tests.py in the Shortlist App:

    1. Tests that the url for '/shortlist/' resolves to the correct viewshortlist.html

Special Thanks

Not in any specific order

  1. To Luca D'Ettore for allowing me to use his name for this fictional website
  2. Richard Dalton for his time teaching and help when needed
  3. Katie Maxwell for her help when needed during the course
  4. Code Institute in general for arranging and developing the course

django_project-1's People

Contributors

miguelmargar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.