Skip to main content

A full Django project packaged for installation

Project description

Github

https://github.com/RobertNagy299/django-webshop

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:

  1. Create a virtual environment (recommended)

    • python -m venv venv
    • source venv/bin/activate
      On Windows: venv\Scripts\activate
  2. Install the package

    • Run the installation command (Can be found on PyPi)
  3. Set up environment variables

    • Create a .env file in your project root:
    • Create all environment variables (see below)
  4. Run migrations

    • run-myproject migrate
  5. Create a superuser - also known as an admin (optional)

    • run-myproject createsuperuser
  6. Run the development server

    • run-myproject runserver
  7. 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'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

band_landing_page_webshop-0.2.0.tar.gz (6.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

band_landing_page_webshop-0.2.0-py3-none-any.whl (6.2 MB view details)

Uploaded Python 3

File details

Details for the file band_landing_page_webshop-0.2.0.tar.gz.

File metadata

File hashes

Hashes for band_landing_page_webshop-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1331454466b7f8f6f373dc3aa16011063d0ed4b8f7960315dc409cbbf396dbcf
MD5 69ffabbee37df8bc4a86ca57fa51a699
BLAKE2b-256 bf5f55419e30554ad188940e1e956298bc34f000cdbeea165462a9fe264f3201

See more details on using hashes here.

File details

Details for the file band_landing_page_webshop-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for band_landing_page_webshop-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1d6a0f9fa06df493eaf70591e1481e92f630f3675da44d4038647402a26a794
MD5 3424c19b63c09847aad778d0318c334a
BLAKE2b-256 7a6a845df9af5064c9455944aa3cc86c57ea6f890a8e02593a71bda3c22751e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page