Skip to content
No description, website, or topics provided.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
rest_api
.gitignore
LICENSE
Pipfile
Pipfile.lock
README.md

README.md

Get Started:

Install pipenv

MacOS

brew install pipenv

Windows (make sure to add pipenv to PATH)

pip install --user pipenv

pipenv docs https://pipenv.readthedocs.io/en/latest/install/#installing-pipenv

Install project dependencies & create virtualenv

cd pro_sports_rest_api
pipenv install

Enter virtualenv and run the dev server for the first time

pipenv shell
cd rest_api

Create a file named ".env" at this level (same as manage.py), with these contents ->

DEBUG=True
SECRET_KEY=du1!*h-j^2ex@-g^+=8#5kes4w3hxt!-x+-ja%&3ao1%*f92_v
DB_ENGINE=django.db.backends.sqlite3

Setup the DB & run dev server on localhost:8000

python manage.py migrate
python manage.py runserver

Leave virtualenv

exit

If not inside virtualenv you can do do:

pipenv run python manage.py runserver

Run scripts to create CSVs and load them into database

python manage.py scrape_team_season_csvs
python manage.py import_team_season_csvs

Those scripts are using selenium with Firefox. It requires geckodriver to work (make sure it is available in PATH) https://github.com/mozilla/geckodriver/releases

Selenium Docs

https://www.seleniumhq.org/docs/03_webdriver.jsp

Django Docs

https://docs.djangoproject.com/en/2.1/

Django REST Framework Docs

https://www.django-rest-framework.org/tutorial/quickstart/

You can’t perform that action at this time.