Skip to content

Commit 8f59faa

Browse files
authored
Merge pull request #1 from kc3hack/feature/zahyou_to_timei
Feature/zahyou to timei
2 parents 33ef0b9 + c817808 commit 8f59faa

38 files changed

+1588
-2
lines changed

docs/development.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ uv run python manage.py runserver
5555

5656
#### MinIO Console
5757
- [http://127.0.0.1:9001](http://127.0.0.1:9001) (u: `minio_admin`, p: `minio_password`)
58+
59+
### インストールしたもの
60+
- Pillow

geodjango/geodjango/__init__.py

Whitespace-only changes.

geodjango/geodjango/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 geodjango 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/6.0/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', 'geodjango.settings')
15+
16+
application = get_asgi_application()

geodjango/geodjango/settings.py

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
"""
2+
Django settings for geodjango project.
3+
4+
Generated by 'django-admin startproject' using Django 6.0.2.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/6.0/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/6.0/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
import os
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/6.0/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = 'django-insecure-9kk224kjigo&fv=qgpuf_eyp6q%d-y8fl$$rw)i25pkzufb@ig'
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+
"django.contrib.gis",
41+
"world",
42+
"storages",
43+
]
44+
MINIO_ENDPOINT_URL = os.environ.get("MINIO_ENDPOINT_URL", "http://localhost:9000")
45+
MINIO_ACCESS_KEY = os.environ.get("MINIO_ROOT_USER", "minio_admin")
46+
MINIO_SECRET_KEY = os.environ.get("MINIO_ROOT_PASSWORD", "minio_password")
47+
MINIO_BUCKET = os.environ.get("MINIO_BUCKET_NAME", "kc3hack-bucket")
48+
MIDDLEWARE = [
49+
'django.middleware.security.SecurityMiddleware',
50+
'django.contrib.sessions.middleware.SessionMiddleware',
51+
'django.middleware.common.CommonMiddleware',
52+
'django.middleware.csrf.CsrfViewMiddleware',
53+
'django.contrib.auth.middleware.AuthenticationMiddleware',
54+
'django.contrib.messages.middleware.MessageMiddleware',
55+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
56+
]
57+
STORAGES = {
58+
"default": {
59+
"BACKEND": "storages.backends.s3.S3Storage",
60+
"OPTIONS": {
61+
"access_key": MINIO_ACCESS_KEY,
62+
"secret_key": MINIO_SECRET_KEY,
63+
"bucket_name": MINIO_BUCKET,
64+
"endpoint_url": MINIO_ENDPOINT_URL,
65+
"region_name": "us-east-1",
66+
"use_ssl": False,
67+
"verify": False,
68+
"default_acl": None,
69+
},
70+
},
71+
#ここよくわからんstaticfilesはローカルに保存するための設定。本番環境だとどうなるか不明。
72+
"staticfiles": {
73+
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
74+
},
75+
}
76+
ROOT_URLCONF = 'geodjango.urls'
77+
78+
TEMPLATES = [
79+
{
80+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
81+
'DIRS': [],
82+
'APP_DIRS': True,
83+
'OPTIONS': {
84+
'context_processors': [
85+
'django.template.context_processors.request',
86+
'django.contrib.auth.context_processors.auth',
87+
'django.contrib.messages.context_processors.messages',
88+
],
89+
},
90+
},
91+
]
92+
93+
WSGI_APPLICATION = 'geodjango.wsgi.application'
94+
95+
96+
# Database
97+
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
98+
99+
DATABASES = {
100+
"default": {
101+
"ENGINE": "django.contrib.gis.db.backends.postgis",
102+
"NAME": "mapdb",
103+
"USER": "kc3hack_user",
104+
"PASSWORD": "kc3hack_password",
105+
"HOST": "localhost",
106+
"PORT": "5432",
107+
}
108+
}
109+
110+
PATIALITE_LIBRARY_PATH = "/usr/lib/x86_64-linux-gnu/mod_spatialite.so"
111+
# Password validation
112+
# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators
113+
114+
AUTH_PASSWORD_VALIDATORS = [
115+
{
116+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
117+
},
118+
{
119+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
120+
},
121+
{
122+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
123+
},
124+
{
125+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
126+
},
127+
]
128+
129+
130+
# Internationalization
131+
# https://docs.djangoproject.com/en/6.0/topics/i18n/
132+
133+
LANGUAGE_CODE = 'en-us'
134+
135+
TIME_ZONE = 'UTC'
136+
137+
USE_I18N = True
138+
139+
USE_TZ = True
140+
141+
142+
# Static files (CSS, JavaScript, Images)
143+
# https://docs.djangoproject.com/en/6.0/howto/static-files/
144+
145+
STATIC_URL = 'static/'

geodjango/geodjango/urls.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
URL configuration for geodjango project.
3+
4+
The `urlpatterns` list routes URLs to views. For more information please see:
5+
https://docs.djangoproject.com/en/6.0/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, include
19+
20+
urlpatterns = [
21+
path('admin/', admin.site.urls),
22+
path("maps/", include("world.urls")),
23+
]

geodjango/geodjango/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 geodjango 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/6.0/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', 'geodjango.settings')
15+
16+
application = get_wsgi_application()

geodjango/manage.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'geodjango.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()

geodjango/world/__init__.py

Whitespace-only changes.

geodjango/world/admin.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.contrib.gis import admin
2+
from .models import WorldBorder, Pin
3+
4+
admin.site.register(WorldBorder, admin.ModelAdmin)
5+
admin.site.register(Pin, admin.ModelAdmin)

geodjango/world/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class WorldConfig(AppConfig):
5+
name = 'world'

0 commit comments

Comments
 (0)