Skip to content

Commit

Permalink
[fix] Separate version to avoid circular import
Browse files Browse the repository at this point in the history
This patch allows importing the version from settings.py
without suffering exceptions which are caused by circular
imports.
  • Loading branch information
nemesifier committed Dec 27, 2024
1 parent 55507bc commit 65f2497
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
10 changes: 10 additions & 0 deletions tasks/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
dest: "{{ openwisp2_path }}/openwisp2/celery.py"
group: "{{ www_group }}"
mode: 0640
tags: [django_init]

- name: Template version.py
notify: Reload application
template:
src: openwisp2/version.py
dest: "{{ openwisp2_path }}/openwisp2/version.py"
group: "{{ www_group }}"
mode: 0640
tags: [django_init]

- name: Template __init__.py
notify: Reload application
Expand Down
11 changes: 6 additions & 5 deletions templates/openwisp2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from .celery import app as celery_app
from .version import __openwisp_version__, __openwisp_installation_method__

__all__ = ['celery_app']
__openwisp_version__ = '24.11.1'
__openwisp_installation_method__ = (
'{{ openwisp2_installation_method | default("ansible-openwisp2") }}'
)
__all__ = [
'celery_app',
'__openwisp_version__',
'__openwisp_installation_method__'
]
4 changes: 4 additions & 0 deletions templates/openwisp2/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__openwisp_version__ = '24.11.1'
__openwisp_installation_method__ = (
'{{ openwisp2_installation_method | default("ansible-openwisp2") }}'
)

0 comments on commit 65f2497

Please sign in to comment.