prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Email settings not configured
  ### Deployment Method
  
  - [ ] Installer
  - [ ] Docker Development
  - [X] Docker Production
  - [ ] Bare metal Development
  - [ ] Bare metal Production
  - [ ] Digital Ocean image
  - [ ] Other (please provide a link `Steps to Reproduce`
  
  ### Describe the problem*
  
  Hello,
  
  I am having issues configuring the email settings to connect to our on-prem exchange server. 
  
  I have configured the .env file with the following variables (Note - exchange does not require authentication internally)
  
  INVENTREE_EMAIL_HOST
  INVENTREE_EMAIL_PORT
  INVENTREE_EMAIL_SENDER
  
  However, when running the docker container, the 'System Information' screen reports that 'Email settings not configured. Under 'Global Settings' > 'Login Settings' a prompt shows at the top saying 'Outgoing email has not been configured. Some login and sign-up features may not work correctly!'
  
  Apologies if I have missed something obvious in the documentation but I seem to be going round in circles currently. Any help that you could offer would be greatly appreciated. Thank you
  
  ### Steps to Reproduce
  
  1. Stop the contain with `docker compose down` 
  2. Edit .env file to include the email variables (as per https://docs.inventree.org/en/0.10.0/start/config/#email-settings)
  3. Starting the container with `docker compose up -d`
  
  Further steps (Apologies, these might be all guesses at this stage)
  
  1.  I have tried setting these within the configuration file (I believe saved here: `volume/inventree-data/config.yaml` to include host, port, sender, tls and ssl variables, however with no change.
  2. Feeling like I am missing a step, I am running `docker compose run inventree-server invoke update`
  3. I am now running 0.10.1 but with the same issue.
  
  
  
  ### Relevant log output
  
  _No response_
  
  </issue>
  <code>
  [start of InvenTree/InvenTree/status.py]
  1 """Provides system status functionality checks."""
  2 # -*- coding: utf-8 -*-
  3 
  4 import logging
  5 from datetime import timedelta
  6 
  7 from django.conf import settings
  8 from django.utils import timezone
  9 from django.utils.translation import gettext_lazy as _
  10 
  11 from django_q.models import Success
  12 from django_q.monitor import Stat
  13 
  14 import InvenTree.ready
  15 
  16 logger = logging.getLogger("inventree")
  17 
  18 
  19 def is_worker_running(**kwargs):
  20     """Return True if the background worker process is oprational."""
  21     clusters = Stat.get_all()
  22 
  23     if len(clusters) > 0:
  24         # TODO - Introspect on any cluster information
  25         return True
  26 
  27     """
  28     Sometimes Stat.get_all() returns [].
  29     In this case we have the 'heartbeat' task running every 5 minutes.
  30     Check to see if we have any successful result within the last 10 minutes
  31     """
  32 
  33     now = timezone.now()
  34     past = now - timedelta(minutes=10)
  35 
  36     results = Success.objects.filter(
  37         started__gte=past
  38     )
  39 
  40     # If any results are returned, then the background worker is running!
  41     return results.exists()
  42 
  43 
  44 def is_email_configured():
  45     """Check if email backend is configured.
  46 
  47     NOTE: This does not check if the configuration is valid!
  48     """
  49     configured = True
  50 
  51     if InvenTree.ready.isInTestMode():
  52         return False
  53 
  54     if InvenTree.ready.isImportingData():
  55         return False
  56 
  57     if not settings.EMAIL_HOST:
  58         configured = False
  59 
  60         # Display warning unless in test mode
  61         if not settings.TESTING:  # pragma: no cover
  62             logger.debug("EMAIL_HOST is not configured")
  63 
  64     if not settings.EMAIL_HOST_USER:
  65         configured = False
  66 
  67         # Display warning unless in test mode
  68         if not settings.TESTING:  # pragma: no cover
  69             logger.debug("EMAIL_HOST_USER is not configured")
  70 
  71     if not settings.EMAIL_HOST_PASSWORD:
  72         configured = False
  73 
  74         # Display warning unless in test mode
  75         if not settings.TESTING:  # pragma: no cover
  76             logger.debug("EMAIL_HOST_PASSWORD is not configured")
  77 
  78     return configured
  79 
  80 
  81 def check_system_health(**kwargs):
  82     """Check that the InvenTree system is running OK.
  83 
  84     Returns True if all system checks pass.
  85     """
  86     result = True
  87 
  88     if InvenTree.ready.isInTestMode():
  89         # Do not perform further checks if we are running unit tests
  90         return False
  91 
  92     if InvenTree.ready.isImportingData():
  93         # Do not perform further checks if we are importing data
  94         return False
  95 
  96     if not is_worker_running(**kwargs):  # pragma: no cover
  97         result = False
  98         logger.warning(_("Background worker check failed"))
  99 
  100     if not is_email_configured():  # pragma: no cover
  101         result = False
  102         logger.warning(_("Email backend not configured"))
  103 
  104     if not result:  # pragma: no cover
  105         logger.warning(_("InvenTree system health checks failed"))
  106 
  107     return result
  108
  [end of InvenTree/InvenTree/status.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/InvenTree/InvenTree/status.py b/InvenTree/InvenTree/status.py
  --- a/InvenTree/InvenTree/status.py
  +++ b/InvenTree/InvenTree/status.py
  @@ -61,19 +61,13 @@
           if not settings.TESTING:  # pragma: no cover
               logger.debug("EMAIL_HOST is not configured")
   
  -    if not settings.EMAIL_HOST_USER:
  -        configured = False
  -
  -        # Display warning unless in test mode
  -        if not settings.TESTING:  # pragma: no cover
  -            logger.debug("EMAIL_HOST_USER is not configured")
  +    # Display warning unless in test mode
  +    if not settings.TESTING:  # pragma: no cover
  +        logger.debug("EMAIL_HOST_USER is not configured")
   
  -    if not settings.EMAIL_HOST_PASSWORD:
  -        configured = False
  -
  -        # Display warning unless in test mode
  -        if not settings.TESTING:  # pragma: no cover
  -            logger.debug("EMAIL_HOST_PASSWORD is not configured")
  +    # Display warning unless in test mode
  +    if not settings.TESTING:  # pragma: no cover
  +        logger.debug("EMAIL_HOST_PASSWORD is not configured")
   
       return configured
  
verification_info: {"golden_diff": "diff --git a/InvenTree/InvenTree/status.py b/InvenTree/InvenTree/status.py\n--- a/InvenTree/InvenTree/status.py\n+++ b/InvenTree/InvenTree/status.py\n@@ -61,19 +61,13 @@\n         if not settings.TESTING:  # pragma: no cover\n             logger.debug(\"EMAIL_HOST is not configured\")\n \n-    if not settings.EMAIL_HOST_USER:\n-        configured = False\n-\n-        # Display warning unless in test mode\n-        if not settings.TESTING:  # pragma: no cover\n-            logger.debug(\"EMAIL_HOST_USER is not configured\")\n+    # Display warning unless in test mode\n+    if not settings.TESTING:  # pragma: no cover\n+        logger.debug(\"EMAIL_HOST_USER is not configured\")\n \n-    if not settings.EMAIL_HOST_PASSWORD:\n-        configured = False\n-\n-        # Display warning unless in test mode\n-        if not settings.TESTING:  # pragma: no cover\n-            logger.debug(\"EMAIL_HOST_PASSWORD is not configured\")\n+    # Display warning unless in test mode\n+    if not settings.TESTING:  # pragma: no cover\n+        logger.debug(\"EMAIL_HOST_PASSWORD is not configured\")\n \n     return configured\n", "issue": "Email settings not configured\n### Deployment Method\n\n- [ ] Installer\n- [ ] Docker Development\n- [X] Docker Production\n- [ ] Bare metal Development\n- [ ] Bare metal Production\n- [ ] Digital Ocean image\n- [ ] Other (please provide a link `Steps to Reproduce`\n\n### Describe the problem*\n\nHello,\r\n\r\nI am having issues configuring the email settings to connect to our on-prem exchange server. \r\n\r\nI have configured the .env file with the following variables (Note - exchange does not require authentication internally)\r\n\r\nINVENTREE_EMAIL_HOST\r\nINVENTREE_EMAIL_PORT\r\nINVENTREE_EMAIL_SENDER\r\n\r\nHowever, when running the docker container, the 'System Information' screen reports that 'Email settings not configured. Under 'Global Settings' > 'Login Settings' a prompt shows at the top saying 'Outgoing email has not been configured. Some login and sign-up features may not work correctly!'\r\n\r\nApologies if I have missed something obvious in the documentation but I seem to be going round in circles currently. Any help that you could offer would be greatly appreciated. Thank you\n\n### Steps to Reproduce\n\n1. Stop the contain with `docker compose down` \r\n2. Edit .env file to include the email variables (as per https://docs.inventree.org/en/0.10.0/start/config/#email-settings)\r\n3. Starting the container with `docker compose up -d`\r\n\r\nFurther steps (Apologies, these might be all guesses at this stage)\r\n\r\n1.  I have tried setting these within the configuration file (I believe saved here: `volume/inventree-data/config.yaml` to include host, port, sender, tls and ssl variables, however with no change.\r\n2. Feeling like I am missing a step, I am running `docker compose run inventree-server invoke update`\r\n3. I am now running 0.10.1 but with the same issue.\r\n\r\n\n\n### Relevant log output\n\n_No response_\n", "before_files": [{"content": "\"\"\"Provides system status functionality checks.\"\"\"\n# -*- coding: utf-8 -*-\n\nimport logging\nfrom datetime import timedelta\n\nfrom django.conf import settings\nfrom django.utils import timezone\nfrom django.utils.translation import gettext_lazy as _\n\nfrom django_q.models import Success\nfrom django_q.monitor import Stat\n\nimport InvenTree.ready\n\nlogger = logging.getLogger(\"inventree\")\n\n\ndef is_worker_running(**kwargs):\n    \"\"\"Return True if the background worker process is oprational.\"\"\"\n    clusters = Stat.get_all()\n\n    if len(clusters) > 0:\n        # TODO - Introspect on any cluster information\n        return True\n\n    \"\"\"\n    Sometimes Stat.get_all() returns [].\n    In this case we have the 'heartbeat' task running every 5 minutes.\n    Check to see if we have any successful result within the last 10 minutes\n    \"\"\"\n\n    now = timezone.now()\n    past = now - timedelta(minutes=10)\n\n    results = Success.objects.filter(\n        started__gte=past\n    )\n\n    # If any results are returned, then the background worker is running!\n    return results.exists()\n\n\ndef is_email_configured():\n    \"\"\"Check if email backend is configured.\n\n    NOTE: This does not check if the configuration is valid!\n    \"\"\"\n    configured = True\n\n    if InvenTree.ready.isInTestMode():\n        return False\n\n    if InvenTree.ready.isImportingData():\n        return False\n\n    if not settings.EMAIL_HOST:\n        configured = False\n\n        # Display warning unless in test mode\n        if not settings.TESTING:  # pragma: no cover\n            logger.debug(\"EMAIL_HOST is not configured\")\n\n    if not settings.EMAIL_HOST_USER:\n        configured = False\n\n        # Display warning unless in test mode\n        if not settings.TESTING:  # pragma: no cover\n            logger.debug(\"EMAIL_HOST_USER is not configured\")\n\n    if not settings.EMAIL_HOST_PASSWORD:\n        configured = False\n\n        # Display warning unless in test mode\n        if not settings.TESTING:  # pragma: no cover\n            logger.debug(\"EMAIL_HOST_PASSWORD is not configured\")\n\n    return configured\n\n\ndef check_system_health(**kwargs):\n    \"\"\"Check that the InvenTree system is running OK.\n\n    Returns True if all system checks pass.\n    \"\"\"\n    result = True\n\n    if InvenTree.ready.isInTestMode():\n        # Do not perform further checks if we are running unit tests\n        return False\n\n    if InvenTree.ready.isImportingData():\n        # Do not perform further checks if we are importing data\n        return False\n\n    if not is_worker_running(**kwargs):  # pragma: no cover\n        result = False\n        logger.warning(_(\"Background worker check failed\"))\n\n    if not is_email_configured():  # pragma: no cover\n        result = False\n        logger.warning(_(\"Email backend not configured\"))\n\n    if not result:  # pragma: no cover\n        logger.warning(_(\"InvenTree system health checks failed\"))\n\n    return result\n", "path": "InvenTree/InvenTree/status.py"}]}