Skip to content

Commit 65f2497

Browse files
committed
[fix] Separate version to avoid circular import
This patch allows importing the version from settings.py without suffering exceptions which are caused by circular imports.
1 parent 55507bc commit 65f2497

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

tasks/django.yml

+10
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@
4848
dest: "{{ openwisp2_path }}/openwisp2/celery.py"
4949
group: "{{ www_group }}"
5050
mode: 0640
51+
tags: [django_init]
52+
53+
- name: Template version.py
54+
notify: Reload application
55+
template:
56+
src: openwisp2/version.py
57+
dest: "{{ openwisp2_path }}/openwisp2/version.py"
58+
group: "{{ www_group }}"
59+
mode: 0640
60+
tags: [django_init]
5161

5262
- name: Template __init__.py
5363
notify: Reload application

templates/openwisp2/__init__.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from .celery import app as celery_app
2+
from .version import __openwisp_version__, __openwisp_installation_method__
23

3-
__all__ = ['celery_app']
4-
__openwisp_version__ = '24.11.1'
5-
__openwisp_installation_method__ = (
6-
'{{ openwisp2_installation_method | default("ansible-openwisp2") }}'
7-
)
4+
__all__ = [
5+
'celery_app',
6+
'__openwisp_version__',
7+
'__openwisp_installation_method__'
8+
]

templates/openwisp2/version.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__openwisp_version__ = '24.11.1'
2+
__openwisp_installation_method__ = (
3+
'{{ openwisp2_installation_method | default("ansible-openwisp2") }}'
4+
)

0 commit comments

Comments
 (0)