Github
https://github.com/RobertNagy299/django-webshop
PyPi
https://pypi.org/project/band-landing-page-webshop/0.2.0/
Demo Video
Test coverage
I used the coverage package and Django's built in testing framework to
achieve at least 50% test coverage for all major python files.
Coverage report can be seen in the demo video
Code quality
I used Flake8 and bandit to assure that my code follows Pythonic coding standards, and that it doesn't contain any vulnerabilities.
The results of the code analysis can be seen in the demo video.
Features
The website includes a dark/light mode switch, and every page is responsive and looks great on any device!
The site consists of the following pages:
-
Homepage
- Jumbotron with a 'contact us' call-to-action button
- A grid view of the band members, with images and short descriptions
-
Shop
- Grid view of the items
- "Add to cart" buttons
- Users can change the quantity of the items
-
Contact
- Contact form, where users can enter their email and their message
-
Concerts
- A Bootstrap Carousel element contains images and short descriptions of concerts
-
News
- This page contains a form, that users can use to subscribe to the newsletter
-
Cart
- The cart page contains the items the user has put in their shopping cart
- Users can remove items, or proceed to checkout
- Clicking the checkout button will open the Stripe Checkout page.
-
Custom admin page for composing a letter
- This page is only available for site admins
- This page contains a form, which admins can use to send an email to everyone who is subscribed to the newsletter
- Admins can include a call-to-action button
- Furthermore, they can include unique discounts with the CTA button
- The discounts work as unique llinks, only available if the user clicks on the button.
-
Newsletter
- Users can subscribe
- Users can unsubscribe (each email contains the unsubscribe link which is based on a UUID token)
- The site admin can send a letter to all subscribers with a simple form on a custom admin view
- It is not possible to subscribe with the same email address multiple times
- All form fields are validated on the backend
- The sent emails are based on an html template to make them look good, but there is also a fallback in case the html couldn't be rendered in the email
- Users cannot reach the admin site
- Subscribed users are stored in a database
- Unsubscribed users are deleted from the database
-
Contact form
- Users can fill out a contact form
- The form is validated on the backend
- The form is saved in a database
- An email is sent to the site admin containing the contents of the contact form upon a successful submission
-
Shop
- Webshop with Stripe (third party payment processor integration)
- Real payments simulated using Stripe's checkout page using the Stripe API
- Real discount coupons and promo codes implemented with Stripe API (These can be created and sent from the custom admin page - send-newsletter.html - just tick the "include CTA button" checkbox and then specify the percentage and duration)
- Coupon expiration handled on the UI and backend
Installation notes:
-
Create a virtual environment (recommended)
python -m venv venvsource venv/bin/activate
On Windows:venv\Scripts\activate
-
Install the package
- Run the installation command (Can be found on PyPi)
- Run the installation command (Can be found on PyPi)
-
Set up environment variables
- Create a .env file in your project root:
- Create all environment variables (see below)
-
Run migrations
run-myproject migrate
-
Create a superuser - also known as an admin (optional)
run-myproject createsuperuser
-
Run the development server
run-myproject runserver
-
Then open your browser and go to
http://127.0.0.1:8000
Environment variables:
SECURITY WARNING: keep the secret key used in production secret!
SECURITY WARNING: don't run with debug turned on in production!
SECRET_KEY = config("SECRET_KEY")
DEBUG = config("DEBUG", cast=bool)
DEFAULT_HOST_BASE_URL = config("DEFAULT_HOST_BASE_URL")
Email config
EMAIL_BACKEND = config("EMAIL_BACKEND") EMAIL_HOST = config("EMAIL_HOST") EMAIL_PORT = config("EMAIL_PORT") EMAIL_USE_TLS = config("EMAIL_USE_TLS", cast=bool) EMAIL_HOST_USER = config("EMAIL_HOST_USER")
Not your actual Gmail password! Use an App Password.
EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD")
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SYSADMIN_DEFAULT_EMAIL_RECIPIENT = config("SYSADMIN_DEFAULT_EMAIL_RECIPIENT")
Stripe setup
STRIPE_SECRET_KEY = config("STRIPE_SECRET_KEY")
STRIPE_PUBLISHABLE_KEY = config("STRIPE_PUBLISHABLE_KEY")
Example .env file:
SECRET_KEY='asd'
EMAIL_BACKEND='youremailbackend'
EMAIL_HOST='yourhost.example.com'
EMAIL_PORT=1521
EMAIL_USE_TLS=True
EMAIL_HOST_USER='yourname@gmail.com'
EMAIL_HOST_PASSWORD='acde efgh ijkl mnop'
SYSADMIN_DEFAULT_EMAIL_RECIPIENT='admin@gmail.com'
DEBUG=False
DEFAULT_HOST_BASE_URL="http://127.0.0.1:8000"
DB_ENGINE='dbengine'
DB_NAME='dbname'
STRIPE_SECRET_KEY='stripe_secret_key'
STRIPE_PUBLISHABLE_KEY='stripe_publishable_key'
Metadata
Release files for band-landing-page-webshop 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| band_landing_page_webshop-1.0.0.tar.gz | 6.2 MB | Without provenance | Details for band_landing_page_webshop-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| band_landing_page_webshop-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for band_landing_page_webshop-1.0.0-py3-none-any.whl |
Total release size: 12.4 MB
Release files / band_landing_page_webshop-1.0.0.tar.gz
| Download URL | band_landing_page_webshop-1.0.0.tar.gz |
|---|---|
| Size | 6.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b47450781ce7956812454935e3f3bbfc0978804469d9774e6f8cf68e7a4cadc9
|
|
BLAKE2b-256 checksum How to use checksums |
d69c1c7e4e010ebda2a68a85c107206b4b600403e88362a12e7d4ae6f2a62bc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / band_landing_page_webshop-1.0.0-py3-none-any.whl
| Download URL | band_landing_page_webshop-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
caf2654c6182398414e8ea1f2e2561907021933440bb576130d427267332a689
|
|
BLAKE2b-256 checksum How to use checksums |
07a5cd05b40d404ee7976e9d5f403ff10c9e7c2f8562c77c222d64f15e75689f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Security for band-landing-page-webshop 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.