title: Accessing django models from a new script
body: <p>I have seen many answers on how to use django models outside the project. But I have no success with any. I was trying to implement <a href="https://stackoverflow.com/a/2180431/5380429">this</a> answer but I get an error. I have created a new file "script.py" inside my app. </p>
  
  <p>script.py</p>
  
  <pre><code>from django.conf import settings
  settings.configure(
      DATABASE_ENGINE = 'sqlite3',
      DATABASE_NAME = '/home/shivam/study/Python/automation/project/db.sqlite3',
      DATABASE_USER = '',
      DATABASE_PASSWORD = '',
      DATABASE_HOST = '',
      DATABASE_PORT = '',
      TIME_ZONE = 'America/New_York',
  )
  from models import *
  </code></pre>
  
  <p>When I run this script, I get an error.</p>
  
  <pre><code>Traceback (most recent call last):
    File "script.py", line 11, in &lt;module&gt;
      from models import *
    File "/home/shivam/study/Python/automation/project/videos/models.py", line 11, in &lt;module&gt;
      class video(models.Model):
    File "/home/shivam/study/Python/automation/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 105, in __new__
      app_config = apps.get_containing_app_config(module)
    File "/home/shivam/study/Python/automation/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 237, in get_containing_app_config
      self.check_apps_ready()
    File "/home/shivam/study/Python/automation/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
      raise AppRegistryNotReady("Apps aren't loaded yet.")
  django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
  </code></pre>
  
  <p>Can somebody help me with this? </p>