title: Django standalone app - problem reading app settings in main project
body: <p>I am using Django 3.2</p>
  <p>I am writing a standalone app <code>MyApp</code> that uses <a href="https://pypi.org/project/geoip2/0.1.0/" rel="nofollow noreferrer">GeoIP2</a></p>
  <p>I want to be able to have a project using the <code>MyApp</code> app, to be able to do either one of the following.</p>
  <ol>
  <li>set GEOIP2_PATH in project.settings  OR</li>
  <li>(default) fall back on the GEOIP2_PATH value set in MyApp.settings</li>
  </ol>
  <p>This is what I have so far:</p>
  <h4>MyApp/settings.py</h4>
  <pre><code>import os
  
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  GEOIP_PATH = os.path.join(BASE_DIR, 'userprofile/geodata')
  
  # ...
  </code></pre>
  <h3>MyApp/utils.py</h3>
  <pre><code>from django.conf import settings
  from MyApp import settings as myapp_settings
  
  
  def get_attribute_from_settings(attribute_name):
      try:
          value = getattr(settings, attribute_name)
  
      except AttributeError:
          try:
              value = getattr(myapp_settings, attribute_name)
  
          except AttributeError:
              raise ImproperlyConfigured()
  
      finally:
          return value 
  </code></pre>
  <h4>Code that uses GeoIP2</h4>
  <pre><code>from django.contrib.gis.geoip2 import GeoIP2, GeoIP2Exception
  from ipware import get_client_ip
  
  geo = GeoIP2()
  
  
  def do_something(address):
      # Barfs at next line: 
      info = geo.city(address)
  </code></pre>
  <p>When the function above is called, I get the following exception thrown:</p>
  <blockquote>
  <p>raise GeoIP2Exception('GeoIP path must be provided via parameter or the GEOIP_PATH setting.')
  django.contrib.gis.geoip2.base.GeoIP2Exception: GeoIP path must be provided via parameter or the GEOIP_PATH setting</p>
  </blockquote>
  <p>How can I use the <code>get_attribute_from_settings()</code> to get the default GEOIP2_PATH if not set in project.settings?</p>