Skip to content

Commit 2ba4f38

Browse files
committed
add settings
1 parent 61cffa8 commit 2ba4f38

File tree

6 files changed

+224
-6
lines changed

6 files changed

+224
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ dependencies = [
1111
"markdown>=3.7",
1212
"psycopg>=3.2.5",
1313
"wagtail>=6.4.1",
14+
"wagtail-bakery>=0.8.0",
1415
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .base import *

pythonkr_backend/pythonkr_backend/settings.py renamed to pythonkr_backend/pythonkr_backend/settings/base.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
"""
1212

1313
from pathlib import Path
14+
import os
1415

1516
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16-
BASE_DIR = Path(__file__).resolve().parent.parent
17+
BASE_DIR = Path(__file__).resolve().parent.parent.parent
1718

1819

1920
# Quick-start development settings - unsuitable for production
@@ -25,7 +26,7 @@
2526
# SECURITY WARNING: don't run with debug turned on in production!
2627
DEBUG = True
2728

28-
ALLOWED_HOSTS = []
29+
ALLOWED_HOSTS = ['*']
2930

3031

3132
# Application definition
@@ -37,6 +38,23 @@
3738
'django.contrib.sessions',
3839
'django.contrib.messages',
3940
'django.contrib.staticfiles',
41+
'django.contrib.sitemaps',
42+
"wagtail.contrib.forms",
43+
"wagtail.contrib.redirects",
44+
"wagtail.embeds",
45+
"wagtail.sites",
46+
"wagtail.users",
47+
"wagtail.snippets",
48+
"wagtail.documents",
49+
"wagtail.images",
50+
"wagtail.search",
51+
"wagtail.admin",
52+
"wagtail",
53+
"modelcluster",
54+
"taggit",
55+
"bakery",
56+
"wagtailbakery",
57+
"pythonkr",
4058
]
4159

4260
MIDDLEWARE = [
@@ -47,6 +65,7 @@
4765
'django.contrib.auth.middleware.AuthenticationMiddleware',
4866
'django.contrib.messages.middleware.MessageMiddleware',
4967
'django.middleware.clickjacking.XFrameOptionsMiddleware',
68+
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
5069
]
5170

5271
ROOT_URLCONF = 'pythonkr_backend.urls'
@@ -121,3 +140,32 @@
121140
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
122141

123142
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
143+
144+
145+
# wagtail
146+
147+
STATIC_ROOT = os.path.join(BASE_DIR, "static")
148+
149+
WAGTAIL_SITE_NAME = "python.or.kr"
150+
151+
WAGTAILADMIN_BASE_URL = "http://127.0.0.1:8000/cms/"
152+
153+
WAGTAILDOCS_EXTENSIONS = [
154+
"csv",
155+
"docx",
156+
"key",
157+
"odt",
158+
"pdf",
159+
"pptx",
160+
"rtf",
161+
"txt",
162+
"xlsx",
163+
"zip",
164+
]
165+
166+
BAKERY_MULTISITE = True
167+
BUILD_DIR = os.path.join(BASE_DIR, "build")
168+
169+
BAKERY_VIEWS = (
170+
"wagtailbakery.views.AllPublishedPagesView",
171+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from pathlib import Path
2+
import os
3+
4+
from .base import *
5+
6+
DATABASES = {
7+
'default': {
8+
'ENGINE': 'django.db.backends.postgresql',
9+
'NAME': 'pk',
10+
}
11+
}
12+
13+
CSRF_TRUSTED_ORIGINS = ["https://pk.iz4u.net"]
14+
15+
16+
# wagtail
17+
18+
STATIC_ROOT = "/home/pk/static"
19+
20+
MEDIA_ROOT = "/home/pk/data/media"
21+
22+
# bakery
23+
24+
BAKERY_MULTISITE = True
25+
BUILD_DIR = os.path.join("/home/pk/bakery_static", "build")

pythonkr_backend/pythonkr_backend/urls.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
URL configuration for pythonkr_backend project.
2+
URL configuration for pao_backend project.
33
44
The `urlpatterns` list routes URLs to views. For more information please see:
55
https://docs.djangoproject.com/en/5.1/topics/http/urls/
@@ -14,9 +14,24 @@
1414
1. Import the include() function: from django.urls import include, path
1515
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1616
"""
17+
import os
1718
from django.contrib import admin
18-
from django.urls import path
19+
from django.urls import path, include
20+
from django.conf.urls.static import static
21+
22+
from django.conf import settings
23+
24+
from wagtail.admin import urls as wagtailadmin_urls
25+
from wagtail import urls as wagtail_urls
26+
from wagtail.documents import urls as wagtaildocs_urls
27+
from wagtail.contrib.sitemaps.views import sitemap
1928

2029
urlpatterns = [
21-
path('admin/', admin.site.urls),
22-
]
30+
path("sitemap.xml", sitemap),
31+
path("admin/", admin.site.urls),
32+
path("cms/", include(wagtailadmin_urls)),
33+
path("documents/", include(wagtaildocs_urls)),
34+
path("", include(wagtail_urls)),
35+
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
36+
37+
urlpatterns += static(settings.MEDIA_URL + 'images/', document_root=os.path.join(settings.MEDIA_ROOT, 'images'))

uv.lock

Lines changed: 128 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)