title: AttributeError: 'module' object has no attribute 'setup'; django setup working in one project but not other
body: <pre><code>#!/usr/bin/env python
  # coding: utf-8
  
  import os, sys, subprocess, time, re, ast
  
  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webapi.server.project.settings")
  
  import django
  django.setup()
  
  from django.apps import apps
  </code></pre>
  
  <p>try:</p>
  
  <pre><code>cchilders: ./write_creation_tests.py 
  Traceback (most recent call last):
    File "./write_creation_tests.py", line 17, in &lt;module&gt;
      django.setup()
  AttributeError: 'module' object has no attribute 'setup
  </code></pre>
  
  <p>if I remove the setup attempt I can't import apps:</p>
  
  <pre><code>#!/usr/bin/env python
  # coding: utf-8
  
  import os, sys, subprocess, time, re, ast
  
  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webapi.server.project.settings")
  
  from django.apps import apps
  </code></pre>
  
  <p>try:</p>
  
  <pre><code>cchilders: ./write_creation_tests.py 
  Traceback (most recent call last):
    File "./write_creation_tests.py", line 19, in &lt;module&gt;
      from django.apps import apps
  ImportError: No module named apps
  </code></pre>
  
  <p>in manage.py:</p>
  
  <pre><code>if __name__ == "__main__":
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webapi.server.project.settings")
  </code></pre>
  
  <p>thus my <code>os.environ</code> setting matches the format in another project. I run this script the same way in the other django project and it works, but not in my webapi. These projects are on pythonpath. How can I setup django? Thank you</p>