Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
f65fd8d
Initial commit
suhhyun524 Mar 21, 2023
0f9bd60
[init]
suhhyun524 Mar 24, 2023
8199d9e
[chore] add code
suhhyun524 Mar 25, 2023
b02e6f6
feat: 게시판 기능
CYJhub Mar 31, 2023
cd1e53c
feat: timetable 기능
CYJhub Mar 31, 2023
d9ce505
feat: account 생성
CYJhub Mar 31, 2023
291a8c8
refactor: TimestampedModel 적용
CYJhub Mar 31, 2023
4b967a2
feat: models.py 수정
CYJhub Mar 31, 2023
6e1a719
update README.md
CYJhub Apr 1, 2023
082b15c
docs: README.md 수정
CYJhub Apr 1, 2023
039de93
feat: 피드백반영
CYJhub Apr 3, 2023
696c24f
feat:ERD 수정
CYJhub Apr 3, 2023
237c3e2
feat: message, post_media Table 제거
CYJhub Apr 4, 2023
00cdea8
feat: class name 수정
CYJhub Apr 4, 2023
a350139
feat: install DRF
CYJhub Apr 4, 2023
b242249
feat: create account serializers.py
CYJhub Apr 4, 2023
1402ab5
feat: create board serializers.py
CYJhub Apr 4, 2023
48c803f
feat: create timetable serializers.py
CYJhub Apr 4, 2023
e341fff
feat: create urls.py and views.py
CYJhub Apr 4, 2023
540bc36
fix: urls.py as_view()추가
CYJhub Apr 6, 2023
4f1156e
feat: create ViewSet
CYJhub Apr 6, 2023
5c472bb
refactor: make viewset & apply filter
CYJhub Apr 7, 2023
85be4b4
fix: add djangorestframework to requirements
CYJhub Apr 7, 2023
8faeacc
refactor: implemented serializers.py
CYJhub Apr 8, 2023
93eb60d
doc: write README.md
CYJhub Apr 8, 2023
511a726
feat: 회원가입 serializer 작성
CYJhub May 2, 2023
351f62e
feat: JWT 기반 인증 초기 환경 세팅
CYJhub May 2, 2023
4fd0d98
feat: base에 권한 설정 추가
CYJhub May 2, 2023
8f3993b
feat: 회원가입, 로그인 완성
CYJhub May 2, 2023
6026f8d
feat: 인증까지 구현 & update: README.md
CYJhub May 5, 2023
1afba5b
feat: forms.py 수정
CYJhub May 6, 2023
01d79a0
chore: 주석 검사
CYJhub May 6, 2023
1e517f9
docs: update README.md
CYJhub May 6, 2023
780f600
[feat] docker 설치
CYJhub May 10, 2023
73ae1fa
[feat] docker-compose.prod.yml 바꿈
CYJhub May 10, 2023
9e52f68
[feat] 기능테스트
CYJhub May 11, 2023
83dd690
[feat] 주석 지우기
CYJhub May 11, 2023
59552c7
[feat] ports 변경
CYJhub May 11, 2023
dda5464
[feat] .env 수정
CYJhub May 11, 2023
0917bf5
[feat] 테스트
CYJhub May 11, 2023
977d8bd
[fea] db
CYJhub May 12, 2023
f8493e9
[feat] .env.prod 추적 삭제
CYJhub May 12, 2023
307d7f1
[feat] 파일 업로드
CYJhub May 12, 2023
12eb599
[docs] update README.md
CYJhub May 12, 2023
f844d7b
[docs] README.md
CYJhub May 12, 2023
62f3cb1
[docs] update README.MD
CYJhub May 13, 2023
aec734b
[feat] 브랜치 변경
CYJhub May 13, 2023
6e325a6
[docs] update README.md
CYJhub May 13, 2023
95c7d5c
[feat].
CYJhub May 13, 2023
cad84d8
Merge commit '95c7d5c'
CYJhub May 13, 2023
fc41176
[docs] update README.md
CYJhub May 15, 2023
d77a31a
[feat] ip 추가
CYJhub May 16, 2023
a61930d
[feat] base.py수정
CYJhub May 16, 2023
7abb322
[feat] private_ip 지우기
CYJhub May 16, 2023
b346cc5
[feat] 다시 private ip 추가
CYJhub May 17, 2023
e5bf884
[feat] 프록시 버퍼 설정 추가
CYJhub May 17, 2023
053fe80
[feat] 0000
CYJhub May 17, 2023
b142f23
[feat] 다시
CYJhub May 17, 2023
6ae51c7
[feat] gunicorn 타임아웃추가
CYJhub May 17, 2023
7812a56
[feat] allowedhost
CYJhub May 17, 2023
e503b61
[feat] 다시추가
CYJhub May 17, 2023
fd546e2
[feat] 프록시 패스 다시설정
CYJhub May 17, 2023
16ddd39
[feat] http추가
CYJhub May 17, 2023
682a065
[feat] *
CYJhub May 17, 2023
92fe4c9
[feat] nginx
CYJhub May 18, 2023
49e83a4
[feat] * 추가
CYJhub May 19, 2023
291beb7
[feat] 다시
CYJhub May 19, 2023
b5feb7b
[docs] update README.md
CYJhub May 19, 2023
e655292
[docs] update README.md
CYJhub May 20, 2023
5739cad
[feat] host설정
CYJhub May 21, 2023
8ef8892
[feat] nginx
CYJhub May 21, 2023
ddd8dd9
[feat] 리다이렉션 코드 제거
CYJhub May 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy to EC2
on:
push:
branches:
- dev
- master

jobs:

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

.env
.env.prod
# End of https://www.toptal.com/developers/gitignore/api/django
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# pyhton 3.8.3 버전을 담은 이미지를 개조해서 사용할 예정
FROM python:3.8.3-alpine
ENV PYTHONUNBUFFERED 1

# 이미지 내에서 명령어를 실행할 디렉토리 설정
RUN mkdir /app
WORKDIR /app

Expand Down
761 changes: 761 additions & 0 deletions README.md

Large diffs are not rendered by default.

Empty file added account/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions account/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions account/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class AccountConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'account'
70 changes: 70 additions & 0 deletions account/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
from django import forms
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import ugettext_lazy as _
from .models import User,UserManager


# 회원가입 시 필요한 아이디, 이메일, 비밀번호
class UserCreateForm(forms.ModelForm):
user_id=forms.CharField(
label=('User ID'),
required=True,
widget=forms.TextInput(
attrs={
'class': 'form-control',
'placeholder':_('User ID'),
'required': 'True',
}
)
)
email = forms.EmailField(
label=('Email'),
required=True,
widget=forms.EmailInput(
attrs={
'class': 'form-control',
'placeholder':_('Email address'),
'required': 'True',
}
)
)
password1 = forms.CharField(
label=_('Password'),
widget=forms.PasswordInput(
attrs={
'class': 'form-control',
'placeholder': _('Password'),
'required': 'True',
}
)
)
password2 = forms.CharField(
label=_('Password confirmation'),
widget=forms.PasswordInput(
attrs={
'class': 'form-control',
'placeholder': _('Password confirmation'),
'required': 'True',
}
)
)

class Meta:
model = User
fields = ('login_id', 'email')

def clean_password2(self):
password1 = self.cleaned_data.get("password1")
password2 = self.cleaned_data.get("password2")
if password1 and password2 and password1 != password2:
raise forms.ValidationError("Passwords don't match")
return password2

def save(self, commit=True):
# Save the provided password in hashed format
user = super(UserCreateForm, self).save(commit=False)
user.user_id = UserManager.normalize_email(self.cleaned_data['login_id'])
user.set_password(self.cleaned_data["password1"])
if commit:
user.save()
return user
63 changes: 63 additions & 0 deletions account/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Generated by Django 3.2.16 on 2023-03-31 15:00

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='School',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('school_name', models.CharField(max_length=100)),
],
options={
'ordering': ['-created_at', '-updated_at'],
'abstract': False,
},
),
migrations.CreateModel(
name='UserManager',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'ordering': ['-created_at', '-updated_at'],
'abstract': False,
},
),
migrations.CreateModel(
name='User',
fields=[
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('user_id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('id', models.CharField(max_length=20, verbose_name='아이디')),
('password', models.CharField(max_length=128, verbose_name='비밀번호')),
('email', models.EmailField(max_length=128, unique=True, verbose_name='이메일')),
('nickname', models.CharField(max_length=20, unique=True, verbose_name='닉네임')),
('class_of', models.IntegerField(verbose_name='입학연도')),
('name', models.CharField(max_length=20, verbose_name='이름')),
('join_date', models.DateField(auto_now_add=True, verbose_name='가입일')),
('is_active', models.BooleanField(default=True)),
('is_admin', models.BooleanField(default=False)),
('school_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='account.school')),
],
options={
'abstract': False,
},
),
]
16 changes: 16 additions & 0 deletions account/migrations/0002_delete_usermanager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 3.2.16 on 2023-05-02 14:11

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('account', '0001_initial'),
]

operations = [
migrations.DeleteModel(
name='UserManager',
),
]
18 changes: 18 additions & 0 deletions account/migrations/0003_alter_user_class_of.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.16 on 2023-05-02 14:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('account', '0002_delete_usermanager'),
]

operations = [
migrations.AlterField(
model_name='user',
name='class_of',
field=models.IntegerField(null=True, verbose_name='입학연도'),
),
]
29 changes: 29 additions & 0 deletions account/migrations/0004_auto_20230502_2316.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.2.16 on 2023-05-02 14:16

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('account', '0003_alter_user_class_of'),
]

operations = [
migrations.AlterField(
model_name='user',
name='join_date',
field=models.DateField(auto_now_add=True, null=True, verbose_name='가입일'),
),
migrations.AlterField(
model_name='user',
name='name',
field=models.CharField(max_length=20, null=True, verbose_name='이름'),
),
migrations.AlterField(
model_name='user',
name='school_id',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='account.school'),
),
]
Empty file added account/migrations/__init__.py
Empty file.
68 changes: 68 additions & 0 deletions account/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
from core.models import TimestampedModel
import uuid


class School(TimestampedModel):
school_name = models.CharField(max_length=100)

def __str__(self):
return self.school_name


class UserManager(BaseUserManager):
# 필수로 필요한 데이터를 선언
def create_user(self, id, email, password, nickname):
if not id:
raise ValueError('Users must have an user_id')
if not password:
raise ValueError('Password must have and password')
print("usermanager 디버깅")
user = self.model(
id=id,
email=email,
nickname=nickname,
)
user.set_password(password)
user.save(using=self._db)
return user

# python manage.py createsuperuser 사용 시 해당 함수가 사용됨
def create_superuser(self, id, email, password=None):
user = self.create_user(
email,
id=id,
password=password
)
user.is_admin = True
user.save(using=self._db)
return user


class User(AbstractBaseUser,TimestampedModel):
user_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)

id = models.CharField("아이디", max_length= 20)
password = models.CharField("비밀번호", max_length=128)
email = models.EmailField("이메일", max_length=128, unique=True)
nickname = models.CharField("닉네임",max_length=20, unique= True)
class_of = models.IntegerField("입학연도", null=True)
name = models.CharField("이름",max_length=20, null=True)
join_date = models.DateField("가입일", auto_now_add=True, null=True)

is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)

school_id = models.ForeignKey(School, on_delete=models.PROTECT, null=True)

REQUIRED_FIELDS = ['password'] # 필수로 값을 받아야하는 필드
USERNAME_FIELD = 'email'

# custom user 생성 시 필요
objects = UserManager()

def __str__(self):
return self.name


Loading