Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 1.3 KB

README.md

File metadata and controls

26 lines (17 loc) · 1.3 KB

dostuff

This is an interactive API for educational demonstrations, using Django Channels and Django REST framework.

Run:

docker compose up -d --build
docker compose exec web poetry run ./manage.py migrate
docker compose exec web poetry run ./manage.py collectstatic
docker compose exec web poetry run ./manage.py createsuperuser
docker compose exec web poetry run ./manage.py runserver 0.0.0.0:5000

Log in as the new superuser at localhost:5000/admin. Identify or create a token, then go to localhost:5000/rooms/test and run, e.g.

curl -H "Content-Type: application/json" -X POST http://localhost:5000/new_event -H 'Authorization: Token <token>' -d '{"message": "hello world!", "room_name":"test"}'
curl -H "Content-Type: application/json" -X POST http://localhost:5000/new_event -H 'Authorization: Token <token>' -d '{"color": "blue", "room_name":"test"}'

Hit Ctrl-C to stop the server, then stop the containers by running

docker compose down

You can also run the service with daphne directly, as in the Procfile:

docker compose exec web poetry run daphne -p 5000 dostuff.asgi:application --bind 0.0.0.0 -v2