Prototype for the Eventual OpenSUTD Web Platform
Database will not be pushed to GitHub (will be local on your computer). Use the following script to reset the database.
./refresh_db.sh
# set the GitHub access token for GitHub content integrations
# obtain yours from https://github.com/settings/tokens
# and keep it a secret!!
export GH_ACCESS_TOKEN=XXXXXXX
# make this repo your current directory
cd web-platform-prototype
# to reset the database back to sample values
./refresh_db.sh
# for development without docker
python3 manage.py runserver
# running with docker
# - map port 8000 to port 80
# - mount local folder
TAG=latest-dev
docker run --rm \
-p 80:8000 \
--env GH_ACCESS_TOKEN=${GH_ACCESS_TOKEN} \
-v ${PWD}:/app \
opensutd/web-platform:${TAG} \
bash -c " \
./refresh_db.sh && \
python3 manage.py collectstatic --noinput && \
python3 manage.py runserver 0:8000 "
- Create a GitHub Oauth App (https://github.com/settings/developers)
- Take note of your client ID and secret keys
- Go to your running Django instance (e.g. http://localhost:8000)
- Go to http://localhost:8000/admin and log in with default admin credentials (
superadmin
/asdf1234
) - Add a new Social Application and fill in the details from step 2
- Click save and log out from
superadmin
- GitHub Login now works
# make this repo your current directory
cd web-platform-prototype
TAG=latest-dev
docker run --rm \
--env GH_ACCESS_TOKEN=${GH_ACCESS_TOKEN} \
-v ${PWD}:/app \
opensutd/web-platform:latest-dev \
bash -c './refresh_db.sh && python3 manage.py test'
# to test coverage
coverage run --source=. manage.py test && coverage report -m
After every commit to the master branch (eg. made via pull request) the following automatic tests will run:
- Travis CI (runs the Django unit test) - look at the
.travis.yml
file - Snyk vulnerability analysis for Python dependencies
- Codacy code quality check and review
- Coverage report reported via Coveralls.io
# one time setup
git remote add upstream https://github.com/OpenSUTD/web-platform-prototype
# pull upstream changes
git fetch upstream
git merge upstream/master
git push