Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

todaatsushi/champ_django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Champ

Originally a workout generator made in Flask (Code here), it is now migrated over to Django and also extended with new features such as an API. This project was initially my capstone project for Harvard's CS50 which was improved and extended! Check it out at this site.

Getting Started

These instructions will get you a copy of the project up and running on your local machine.

Installing

Using a virtual env (recommended), install dependencies from requirements.txt.

pip install -r requirements.txt

Then, just migrate the databases!

python manage.py migrate

Optional:

python manage.py createsuperuser

to use admin functionalities e.g. edit the database via the api.

Next you'd need to import the exercises themselves which can be found in the repo in workouts.helper.exercises_fin.csv.py. The script read_exercises.py in the helpers directory can just be copy and pasted into a shell:

In practice

Open a shell

python manage.py shell

and copy and paste the read_exercises.py contents into the shell.

.env variables

Champ expects:

  • SECRET_KEY - Django secret key
  • DEBUG - Debug settings ('True' for debug mode)
  • LOCAL_HOST - For running on your machine in dev mode

Email details - Gmail

  • EMAIL_ADDRESS
  • EMAIL_PASSWORD

Database details (MySql) - Production

  • DB_NAME - The name of the database
  • DB_USER - Database user
  • DB_PASSWORD - Databse password
  • DB_HOST - Database location

API

Champ comes with an API accessed by going to /api. The schema can be seen at /api/schema. There are two main models to see api/exercises/id & api/users/id.

Deployment

To serve static files make sure Whitenoise is configured properly and run

python manage.py collectstatic

Built With

Authors

License

This project is licensed under the MIT License.