recently
This commit is contained in:
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@ -0,0 +1,33 @@
|
||||
# pull official base image
|
||||
FROM python:3.10-slim-buster
|
||||
|
||||
# set work directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# set environment variable
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# copy project files
|
||||
COPY . /usr/src/app/
|
||||
|
||||
# install system dependencies
|
||||
RUN apt-get update
|
||||
#RUN apt-get install -y gcc pkg-config default-libmysqlclient-dev python-dev vim systemd
|
||||
RUN apt-get install -y gcc pkg-config default-libmysqlclient-dev python-dev
|
||||
RUN apt-get clean
|
||||
|
||||
# install python dependencies
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
# collect static files
|
||||
# RUN python manage.py collectstatic --noinput
|
||||
|
||||
# expose the port
|
||||
EXPOSE 8000
|
||||
|
||||
# command to run
|
||||
CMD ["gunicorn", "--workers=3", "--bind=0.0.0.0:8000", "blog_prj.wsgi:application"]
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
# blog/urls.py
|
||||
|
||||
from django.urls import path
|
||||
from .views import PostListCreateView
|
||||
from .views import PostListView, PostListCreateView
|
||||
|
||||
urlpatterns = [
|
||||
path('posts/', PostListView.as_view(), name='post-list'),
|
||||
path('create/', PostListCreateView.as_view(), name='post-list-create'),
|
||||
]
|
||||
|
@ -1,5 +1,6 @@
|
||||
import requests
|
||||
from rest_framework.exceptions import AuthenticationFailed
|
||||
from django.conf import settings
|
||||
|
||||
def verify_token_with_auth_server(token: str):
|
||||
# url = "http://192.168.0.202:8000/api/auth/verify/"
|
||||
|
@ -5,6 +5,13 @@ from .models import Post
|
||||
from .serializers import PostSerializer
|
||||
from .utils import verify_token_with_auth_server # ✅ 추가
|
||||
|
||||
|
||||
class PostListView(generics.ListAPIView):
|
||||
queryset = Post.objects.all().order_by('-created_at')
|
||||
serializer_class = PostSerializer
|
||||
# permission_classes = [permissions.IsAuthenticated]
|
||||
permission_classes = [permissions.AllowAny]
|
||||
|
||||
class PostListCreateView(generics.ListCreateAPIView):
|
||||
queryset = Post.objects.all().order_by('-created_at')
|
||||
serializer_class = PostSerializer
|
||||
|
@ -13,6 +13,22 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False, # 기존 로거 사용 허용
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
'stream': sys.stdout, # ✅ stdout으로 출력되도록 지정
|
||||
},
|
||||
},
|
||||
'root': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG', # DEBUG 레벨로 모두 출력
|
||||
},
|
||||
}
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@ -78,8 +94,12 @@ CORS_ALLOWED_ORIGINS = [
|
||||
"http://192.168.0.100:3000",
|
||||
"https://demo.test",
|
||||
"http://demo.test",
|
||||
"https://www.demo.test",
|
||||
"https://sample.test",
|
||||
"http://sample.test",
|
||||
"http://www.sample.test",
|
||||
"http://auth.sample.test",
|
||||
"http://blog.sample.test",
|
||||
]
|
||||
|
||||
# by.sdjo 2025-04-22
|
||||
|
@ -24,3 +24,4 @@ sqlparse==0.5.3
|
||||
typing_extensions==4.13.2
|
||||
uritemplate==4.1.1
|
||||
urllib3==2.4.0
|
||||
gunicorn==20.1.0
|
Reference in New Issue
Block a user