Uploaded image for project: 'openATTIC'
  1. openATTIC
  2. OP-1758

Automate the initialization of Django

    XMLWordPrintable

    Details

      Description

      Currently it is necessary to call the following code manually wherever required:

      import django
      if django.VERSION[:2] >= (1, 7):
          django.setup()
      

      e.g. in backend/nagios/plugins/check_oa_utilization or other scripts.

      From the developer point of view i do not want to take care that the necessary backend (Django) is initialized, this should be done automatically, in particular when it is not obvious that this is required, e.g. when importing and using oA modules that use database models like

      from volumes.models import StorageObject
      

      As discussed this with Sebastian W. it would be ideal when this happens in backend/settings.py or an equal location. On the other side there are code locations where it is necessary to initialize Django manually, e.g. in oaconfig --install.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            vtheile Theile, Volker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: