Skip to content

Commit f5c2cd7

Browse files
authored
Feat/spectacular (#16)
* Update requirements.in * Update settings.py-tpl * Update urls.py-tpl * Update test_startcmsproject.yml * Update test_startcmsproject.yml * Update test_startcmsproject.yml * Update test_startcmsproject.yml
1 parent f6de3ca commit f5c2cd7

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

.github/workflows/test_startcmsproject.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
django-version: [
16-
'3.2', '4.2',
16+
'4.2', '5.2',
1717
]
18-
python-version: ['3.11']
18+
python-version: ['3.13']
1919
os: [
20-
ubuntu-20.04,
20+
ubuntu-latest,
2121
]
2222

2323
steps:
@@ -29,9 +29,9 @@ jobs:
2929
python-version: ${{ matrix.python-version }}
3030
- name: Create project from template
3131
run: |
32-
echo $GITHUB_REF
3332
python -m venv .venv
3433
source ./.venv/bin/activate
3534
python -m pip install --upgrade pip
36-
pip install django-cms>=4.1.0rc5
37-
djangocms mysite --noinput
35+
python -m pip install Django~=${{ matrix.django-version}}
36+
python -m pip install django-cms
37+
djangocms mysite --noinput --template https://github.com/${{ github.repository }}/archive/${{ github.head_ref || github.ref_name }}.zip

project_name/settings.py-tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ INSTALLED_APPS = [
6565

6666
'djangocms_rest',
6767
'rest_framework',
68+
'drf_spectacular',
6869
]
6970

7071
MIDDLEWARE = [
@@ -213,3 +214,8 @@ INTERNAL_IPS = [
213214

214215
MEDIA_URL = "media/"
215216
MEDIA_ROOT = str(BASE_DIR.parent / "media")
217+
218+
# Add default schema for drf-spectacular
219+
REST_FRAMEWORK = {
220+
"DEFAULT_SCHEMA_CLASS": 'drf_spectacular.openapi.AutoSchema',
221+
}

project_name/urls.py-tpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ from django.contrib import admin
2121
from django.urls import include, path
2222
from django.views.i18n import JavaScriptCatalog
2323

24+
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
25+
26+
2427
urlpatterns = [
25-
path('', include('djangocms_rest.urls')),
28+
# OpenAPI schema and documentation
29+
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
30+
path('api/docs/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
31+
path('api/', include('djangocms_rest.urls')),
2632
] + i18n_patterns(
2733
path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
2834
path('admin/', admin.site.urls),

requirements.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
git+https://github.com/django-cms/django-cms@release/5.0.x
12
djangocms-versioning
23
djangocms-alias
34
django-filer
45
djangocms-text
56
djangocms-link
67
djangocms-picture
7-
git+https://github.com/fsbraun/djangocms-rest@main
8+
git+https://github.com/django-cms/djangocms-rest@main
9+
drf-spectacular

0 commit comments

Comments
 (0)