drf + channel를 이용한 실시간 ping-pong game server
pip install -r requirements.txt
python manage.py makemigrations game_data game_server
python manage.py migrate game_data
python manage.py migrate game_server
python manage.py runserver
{
"id": "< 게임 데이터 id>",
"user1_id": "<요청 유저의 id>"
"user1_nickname": "<요청 유저의 닉네임>",
"user1_score": "<요청 유저의 점수>",
"user2_id": "<유저1 상대의 id>"
"user2_nickname": "<유저1 상대의 닉네임>",
"user2_score": "<유저1 상대의 점수>",
"match_type": "<랜덤인지 토너먼트인지 type>",
"created_at": "<게임이 끝난 날짜와 시간>",
}
{
"error": "data not found"
}
verify_user.py의 verifying_user를 import
view나 인증이 필요한 작업전에
try:
verifying_user(get_token(request))
authenticate 후 처리할 로직들 ...
해당 USER의 nickname
NONE 반환