Skip to content

Commit b32a878

Browse files
authored
Merge pull request #1 from darjeeling/main
init
2 parents fda1e5c + c4322cf commit b32a878

File tree

20 files changed

+1068
-0
lines changed

20 files changed

+1068
-0
lines changed

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM python:3.12-slim-bookworm
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
3+
4+
ENV PYTHONUNBUFFERED 1
5+
6+
WORKDIR /app
7+
8+
# Copy the project into the image
9+
ADD . /app
10+
11+
# Delete .sqlite3 files
12+
RUN find /app -name "*.sqlite3" -delete
13+
14+
# Sync the project into a new environment, using the frozen lockfile
15+
RUN uv sync --frozen
16+
17+
ENTRYPOINT [ "/app/entrypoint.sh" ]

docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3.8'
2+
3+
services:
4+
db:
5+
image: postgres:16
6+
environment:
7+
POSTGRES_DB: pk
8+
POSTGRES_USER: pk
9+
POSTGRES_PASSWORD: pktesting
10+
volumes:
11+
- postgres_data:/var/lib/postgresql/data
12+
13+
web:
14+
build: .
15+
command: /app/entroypoint.sh
16+
ports:
17+
- "8000:8000"
18+
depends_on:
19+
- db
20+
environment:
21+
- DATABASE_URL=postgres://pk:mypassword@db:5432/mydatabase
22+
23+
volumes:
24+
postgres_data:

entrypoint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
4+
cd /app
5+
source .venv/bin/activate
6+
cd /app/pythonkr_backend
7+
export DJANGO_SETTINGS_MODULE="pythonkr_backend.settings.localtesting"
8+
./manage.py migrate --no-input
9+
./manage.py collectstatic --clear --noinput
10+
gunicorn --workers=2 \
11+
-b :8080 \
12+
--access-logfile - \
13+
--error-logfile - \
14+
pythonkr_backend.wsgi

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[project]
2+
name = "python-or-kr-wip"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"django>=5.1.7",
9+
"gunicorn>=23.0.0",
10+
"httpx>=0.28.1",
11+
"markdown>=3.7",
12+
"psycopg>=3.2.5",
13+
"wagtail>=6.4.1",
14+
"wagtail-bakery>=0.8.0",
15+
]

pythonkr_backend/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', 'pythonkr_backend.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()

pythonkr_backend/pythonkr/__init__.py

Whitespace-only changes.

pythonkr_backend/pythonkr/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

pythonkr_backend/pythonkr/apps.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class PythonkrConfig(AppConfig):
5+
default_auto_field = 'django.db.models.BigAutoField'
6+
name = 'pythonkr'

pythonkr_backend/pythonkr/migrations/__init__.py

Whitespace-only changes.

pythonkr_backend/pythonkr/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

0 commit comments

Comments
 (0)