title: Django 1.6 run stand alone script in Django Environment- No Success
body: <p>I have a stand alone script that I need to run in the Django environment. It uses the Database Orm and such. When I try to run it, it starts off complaining <code>from .generators import thread_generator</code>. So, it's obvious it's not in the Django environment. I have googled and tried many things and still have had no success. Currently, I am trying the below to no success. I am not even sure if <code>bot_server.local</code> is correct or if it should be <code>bot_server.settings</code>. However, I am using <code>local.py</code> in settings. I can't run this as a command because for the use I have for it, I need to run it as a stand alone script. I need this to be permanent from with in the script rather than a shell environment hack that is temp.</p>
  
  <pre><code>from functools import wraps
  import sys
  import os
  import datetime
  import base64
  import json
  from django.db import connection
  from django.core.management.base import BaseCommand, CommandError
  from .generators import thread_generator
  from .do_request import do_request
  from .models import Employee, ThreadVault
  
  if __name__ == '__main__':
      os.environ['DJANGO_SETTINGS_MODULE'] = "bot_server.local"
      sys.path.append("/home/git/bot_server/bot_server")
  </code></pre>