Import model in Django's settings.py
<p>I'm trying to define a constant with the value of model's class in the <code>settings.py</code> to provide a dynamically-defined FK for one of my models:</p>

<pre><code>from catalog.models import Product
PRODUCT_MODEL = Product
</code></pre>

<p>No surprise it's leading to an <code>AppRegistryNotReady</code> exception:</p>

<pre><code>django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
</code></pre>

<p>since there was no call to <code>django.setup()</code> method.</p>

<p>If I add </p>

<pre><code>import django
django.setup()
</code></pre>

<p>in front of the model's import, instead of <code>AppRegistryNotReady</code> exception, I'm getting</p>

<pre><code>AttributeError: 'Settings' object has no attribute 'PRODUCT_MODEL'
</code></pre>

<p>when I'm using </p>

<pre><code>from django.conf import settings
...

product = models.ForeignKey(
    settings.PRODUCT_MODEL, 
    related_name='order_items')
</code></pre>

<p>Is there any way to implement this without errors? </p>

<p>I'm using Python 3.5 and Django 1.9.5.</p>