2022fall_41class_team9
Contact
- 강민구 netisen4@gmail.com
- 구자현 rnwkgus0212@gmail.com
- 김수겸 metishonora@icloud.com
- 연민석 eric9907@naver.com
- 위성은 sachoi1201@naver.com
- 이원규 stbaker517@g.skku.edu
Project Topology
Project: codingplatform
- APP1: codes
- APP2: onlinejudges
- APP3: problems
- APP4: analysis
Project Environment
every materials are based on the "BOOK, Chapter 6"
PLZ Watch the BOOK!
- django: 3.1.6
- django_rest_framework: 3.12.2
Install Python Library
In root directory
- pip3 install -r requirements.txt
When error occurs..
- pip3 install --upgrade pip
How to run locally
- (optional: if migration does not work properly) rm (appname)/migrations/*.py (except __init_\.py!!)
- rm db.sqlite3
- python -m venv your_own_venv
- source your_own_venv/bin/activate
- python pip install django==3.1.6 django_rest_framework==3.12.2
- python manage.py makemigrations
- python manage.py migrate
- python manage.py createsuperuser
- python manage.py runserver
- Goto https://localhost:8000/admin page.
Usage
SELECT with Serializers
from db.models import *
from db.serializers import *
user = UserSerializer(User.objects.get(pk=1)) # SELECT FROM User WHERE primary_key('user_id') = 1
user.data
You can get JSON data.
SELECT *
Course.objects.all()
INSERT INTO db
Course.objects.create(course_id='1', course_name='a_brand_new_course')
DELETE FROM db
Course.objects.get(pk=1).delete()