This is an e-commerce platform for delivering fitness products and services.
π Mastering Fitness
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)product
β 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
- Docker Compose
- Nginx
- 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.
To deploy:
git push heroku 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...
docker-compose exec web 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 test publishable and secret keys from Stripe in .env.dev
.
To build containers and detach the console:
cd fitness-store
docker-compose up -d --build
To update the database schema:
docker-compose exec web 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:
docker-compose exec web python manage.py setup_test_data
Short tests have been made for most of the project.
To run tests:
docker-compose exec web pytest
To see coverage report:
docker-compose exec web coverage run -m pytest
docker-compose exec web coverage report -m