Skip to content

Commit f7f8b68

Browse files
authored
Merge pull request #3 from cmscom/devin/1737125564-add-hello-world
Hello World機能の実装
2 parents 9a34147 + 2090b2a commit f7f8b68

File tree

17 files changed

+287
-1
lines changed

17 files changed

+287
-1
lines changed

.github/workflows/python-tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Python Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python 3.12
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -e ".[dev]"
27+
28+
- name: Run tests
29+
run: |
30+
pytest
31+
32+
- name: Run Ruff
33+
run: |
34+
ruff check .
35+
36+
- name: Run isort
37+
run: |
38+
isort . --check-only

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,16 @@ ruff check .
3434
```bash
3535
isort .
3636
```
37+
38+
## Hello World 機能
39+
ルートパス("/")へアクセスすると "Hello World" が表示されます。
40+
41+
## テスト実行方法
42+
pytestを利用してテストを実行します:
43+
```bash
44+
pytest
45+
```
46+
47+
テストは以下を確認します:
48+
- Hello World機能が正常に動作すること
49+
- ステータスコード200が返されること

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ dependencies = [
1111
[project.optional-dependencies]
1212
dev = [
1313
"ruff>=0.3.0",
14-
"isort>=5.0.0"
14+
"isort>=5.0.0",
15+
"pytest>=7.4.0",
16+
"pytest-django>=4.7.0"
1517
]
1618

1719
[tool.ruff]

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
DJANGO_SETTINGS_MODULE = config.settings
3+
python_files = tests.py test_*.py *_tests.py
4+
pythonpath = src

src/config/__init__.py

Whitespace-only changes.

src/config/asgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for config project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
15+
16+
application = get_asgi_application()

src/config/settings.py

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
"""
2+
Django settings for config project.
3+
4+
Generated by 'django-admin startproject' using Django 5.1.5.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/5.1/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/5.1/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
15+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16+
BASE_DIR = Path(__file__).resolve().parent.parent
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = 'django-insecure-nfja^0+=^sr7i!$b1r*iordx=_8l7%(pabh#gp)f5nb-cssb_9'
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
'helloapp',
41+
]
42+
43+
MIDDLEWARE = [
44+
'django.middleware.security.SecurityMiddleware',
45+
'django.contrib.sessions.middleware.SessionMiddleware',
46+
'django.middleware.common.CommonMiddleware',
47+
'django.middleware.csrf.CsrfViewMiddleware',
48+
'django.contrib.auth.middleware.AuthenticationMiddleware',
49+
'django.contrib.messages.middleware.MessageMiddleware',
50+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
51+
]
52+
53+
ROOT_URLCONF = 'config.urls'
54+
55+
TEMPLATES = [
56+
{
57+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
58+
'DIRS': [],
59+
'APP_DIRS': True,
60+
'OPTIONS': {
61+
'context_processors': [
62+
'django.template.context_processors.debug',
63+
'django.template.context_processors.request',
64+
'django.contrib.auth.context_processors.auth',
65+
'django.contrib.messages.context_processors.messages',
66+
],
67+
},
68+
},
69+
]
70+
71+
WSGI_APPLICATION = 'config.wsgi.application'
72+
73+
74+
# Database
75+
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
76+
77+
DATABASES = {
78+
'default': {
79+
'ENGINE': 'django.db.backends.sqlite3',
80+
'NAME': BASE_DIR / 'db.sqlite3',
81+
}
82+
}
83+
84+
85+
# Password validation
86+
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
87+
88+
AUTH_PASSWORD_VALIDATORS = [
89+
{
90+
'NAME': (
91+
'django.contrib.auth.password_validation.'
92+
'UserAttributeSimilarityValidator'
93+
),
94+
},
95+
{
96+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
97+
},
98+
{
99+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
100+
},
101+
{
102+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
103+
},
104+
]
105+
106+
107+
# Internationalization
108+
# https://docs.djangoproject.com/en/5.1/topics/i18n/
109+
110+
LANGUAGE_CODE = 'en-us'
111+
112+
TIME_ZONE = 'UTC'
113+
114+
USE_I18N = True
115+
116+
USE_TZ = True
117+
118+
119+
# Static files (CSS, JavaScript, Images)
120+
# https://docs.djangoproject.com/en/5.1/howto/static-files/
121+
122+
STATIC_URL = 'static/'
123+
124+
# Default primary key field type
125+
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
126+
127+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

src/config/urls.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
URL configuration for config project.
3+
4+
The `urlpatterns` list routes URLs to views. For more information please see:
5+
https://docs.djangoproject.com/en/5.1/topics/http/urls/
6+
Examples:
7+
Function views
8+
1. Add an import: from my_app import views
9+
2. Add a URL to urlpatterns: path('', views.home, name='home')
10+
Class-based views
11+
1. Add an import: from other_app.views import Home
12+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
13+
Including another URLconf
14+
1. Import the include() function: from django.urls import include, path
15+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16+
"""
17+
from django.contrib import admin
18+
from django.urls import path
19+
20+
from helloapp.views import hello_world_view
21+
22+
urlpatterns = [
23+
path('admin/', admin.site.urls),
24+
path('', hello_world_view, name='hello_world'),
25+
]

src/config/wsgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for config project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
15+
16+
application = get_wsgi_application()

src/helloapp/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)