【Day 2 完了報告】

完了したタスク
Day 2: Djangoセットアップ
成果物
requirements.txt (packages added)
settings.py (configured)
apps/fields, apps/plans, apps/reports (directories created)
レビュー結果
 良い点:

必要なライブラリが適切に追加されました(pandas, PostGIS等)。
settings.py の設定変更(INSTALLED_APPS, DATABASES, REST_FRAMEWORK)が正しく行われています。
アプリケーション構成も指示通りです。
次のステップ
Day 3: データモデル実装(Fields, Plansアプリのモデル作成)
This commit is contained in:
Akira
2026-02-15 11:43:22 +09:00
parent 125cb2d981
commit 9ab5f0b814
25 changed files with 105 additions and 3 deletions

View File

@@ -4,10 +4,17 @@ WORKDIR /app
RUN apt-get update && apt-get install -y \
gcc \
g++ \
postgresql-client \
libpq-dev \
libgdal-dev \
libgeos-dev \
libproj-dev \
&& rm -rf /var/lib/apt/lists/*
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
ENV C_INCLUDE_PATH=/usr/include/gdal
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

0
backend/apps/__init__.py Normal file
View File

View File

View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class FieldsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.fields'

View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

View File

View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class PlansConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.plans'

View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

View File

View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class ReportsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.reports'

View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

View File

@@ -32,9 +32,18 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'rest_framework',
'rest_framework_simplejwt',
'djoser',
'corsheaders',
'apps.fields',
'apps.plans',
'apps.reports',
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
@@ -69,7 +78,7 @@ WSGI_APPLICATION = 'keinasystem.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': os.environ.get('DB_NAME', 'keinasystem'),
'USER': os.environ.get('DB_USER', 'keinasystem'),
'PASSWORD': os.environ.get('DB_PASSWORD', ''),
@@ -119,3 +128,27 @@ STATIC_URL = 'static/'
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
}
from datetime import timedelta
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(hours=24),
'REFRESH_TOKEN_LIFETIME': timedelta(days=7),
}
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"http://127.0.0.1:3000",
]
LANGUAGE_CODE = 'ja'
TIME_ZONE = 'Asia/Tokyo'

View File

@@ -1,3 +1,11 @@
Django>=5.0,<6.0
psycopg2-binary>=2.9,<3.0
Django==5.0
djangorestframework==3.14
django-cors-headers==4.3
psycopg2-binary>=2.9
djoser==2.2
djangorestframework-simplejwt==5.3
pandas>=2.1,<3.0
odfpy==1.4
WeasyPrint==60.1
gunicorn>=21.0,<22.0
setuptools<75