This is an e-commerce platform for delivering fitness products and services.
Current features:
- Layout powered by Every Layout and basic CSS
payments
– powered by Stripe Checkout with information synced from Django Admin dashboardpages
– markdown-powered pages (ex: About page)products
– foundation of the shop with extendable Product abstract base class (ex: 30 Days of Fitness)exercises
– exercise database with instruction videos and alternative suggestions (Exercises)cardio
– self-generated cardio workouts (Cardio)timer
- interval timer in JavaScript (Timer)users
– user authentication and authorizationfeed
– RSS feed (ex: Product Feed)robots.txt
– for search enginessitemap.xml
– for search engines (ex: Sitemap)
Current features:
- Docker and Docker Compose
- Redis for caching static pages
- PostgreSQL
- pytest
- custom User model
This is emulated in docker-compose.prod.yml.
This app runs in a container on Heroku with a heroku-postgresql database addon. New code pushed to GitHub is chain-pushed to Heroku.
To deploy:
git push origin main
If a new feature requires changes to the database schema, it may be taken care of in heroku.yml
Release phase. This is untested.
If the release command does not work, run it manually:
heroku run python manage.py migrate
The address of Django's admin backend has been changed from /admin/
to /backside/
.
Static files must be copied in a similar fashion if updated:
heroku run python manage.py collectstatic
To create a superuser:
heroku run python manage.py createsuperuser
This should ask for username, email, and password.
You can edit the user's full name in the Django shell...
python manage.py shell
>>> from django.contrib.auth import get_user_model
>>> User = get_user_model()
>>> me = User.objects.get(username="<the username you typed")
>>> me.full_name = "<Desired Name>"
>>> me.save()
...or in the Django admin at http://localhost:8000/backside/users/user/
Be sure to include Stripe test mode publishable and secret keys in .env.dev
.
To build the database and cache containers:
cd fitness-store
docker-compose up -d --build
To run the Django development server:
cd app
python manage.py runserver
To update the database schema:
cd app
python manage.py migrate
To see running container logs:
docker-compose logs -f
To test if a purchase gives a user the permission to view a purchased product, you'll need to forward those events from Stripe to the local server instead of the live server in production. Make sure to list the appropriate webhook URL for handling the triggered events.
stripe login
stripe listen --forward-to localhost:8000/payments/webhook/
Once listening, you must trigger the event by performing the corresponding actions on your site or by using the Stripe CLI, e.g. stripe trigger checkout.session.completed
.
To setup test data:
python manage.py setup_test_data
Short tests have been made for most of the project.
To run tests:
pytest
To see coverage report:
coverage run -m pytest
coverage report -m