Skip to content

Commit cae4582

Browse files
Ап
1 parent 430e401 commit cae4582

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

.github/workflows/pypi.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ jobs:
2121
- name: Update pyproject.toml version
2222
run: |
2323
sed -i "s/^version = .*/version = \"${{ env.RELEASE_VERSION }}\"/" pyproject.toml
24-
cat pyproject.toml # Для проверки
24+
cat pyproject.toml
25+
26+
- name: Update __init__.py version
27+
run: |
28+
sed -i "s/^__version__ = .*/__version__ = \"${{ env.RELEASE_VERSION }}\"/" src/cotlette/__init__.py
29+
cat src/cotlette/__init__.py
2530
2631
- name: Set up Python
2732
uses: actions/setup-python@v4

src/cotlette/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
__version__ = "0.1.0"
2-
VERSION = "0.1.0"
1+
__version__ = "0.0.0"

src/cotlette/conf/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ def __init__(self, settings_module):
159159

160160
mod = importlib.import_module(self.SETTINGS_MODULE)
161161

162+
# Передача версии в settings
163+
setattr(mod, "VERSION", cotlette.__version__)
164+
162165
tuple_settings = (
163166
"ALLOWED_HOSTS",
164167
"INSTALLED_APPS",

test_project1/apps/admin/jinja2/includes/sidebar.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ <h6 class="text-white up mb-0">Need help?</h6>
160160
</div>
161161
</div> -->
162162

163-
<!-- <a target="_blank"
163+
<a target="_blank"
164164
class="btn bg-gradient-primary mt-9 w-100"
165-
href="https://github.com/ForceFledgling/cotlette">© 2025 Cotlette</a> -->
165+
href="https://github.com/ForceFledgling/cotlette">© 2025 Cotlette {{config.VERSION}}</a>
166166
</div>
167167
</aside>

test_project1/apps/admin/urls.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import os
2+
13
from fastapi import APIRouter, Request
24
from cotlette.shortcuts import render
35

4-
router = APIRouter()
5-
6-
import os
6+
from cotlette.conf import settings
77

8+
router = APIRouter()
89

910

1011
def url_for(endpoint, **kwargs):
@@ -27,7 +28,8 @@ async def test(request: Request):
2728
return render(request=request, template_name="pages/index.html", context={
2829
"url_for": url_for,
2930
"parent": "home",
30-
"segment": "test"
31+
"segment": "test",
32+
"config": settings,
3133
})
3234

3335
@router.get("/accounts_login", response_model=None)

test_project1/config/settings.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pathlib
22

3-
43
# Базовая директория проекта
54
BASE_DIR = pathlib.Path(__file__).resolve().parent.parent
65

0 commit comments

Comments
 (0)