-
Notifications
You must be signed in to change notification settings - Fork 0
Django Quick Start
mgale456 edited this page Mar 5, 2020
·
5 revisions
Highly recommend the Django Tutorial to learn more. Although it does not cover websocket connections, since it is through a package called Channels
Django organizes stuff as a "project" and "app"
Our project is "composeexample" and our app is "team_management" I don't foresee us needing another app, since most of our stuff is intertwined, but we might in the future.
We currently have 4 active urls (This structure will change soon, I think):
- / (Homepage)
- /games/ (list of games)
- /games/#/ (judging page for a game #)
- /scoreboard/#/ (scoreboard for a game #)
- /admin/ (username: MRDC; password: password; used to manually add rows to the DB)
the websocket is currently served to /ws/game/# (we can have multiple connected here, and use this url to have different handlers for websockets on different pages)
The most important documents to edit are:
- html templates inside
team_management/templates/team_management/
-
team_management/consumers.py
- receives websocket communication -
team_management/urls.py
- routes urls and calls a function in views.py -
team_management/views.py
- queries the database and then renders the html templates
Other important files (that shouldn't change much):
-
team_management/models.py
- Defines the database schema
Models: Django's name for database tables. They are a class in Python. A single object of this class is equivalent to one row in the DB