def main():
sys.exc_clear()<EOL>os.environ["<STR_LIT>"] = "<STR_LIT>"<EOL>from django.conf import global_settings<EOL>global_settings.INSTALLED_APPS = (<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>)<EOL>if django.VERSION > (<NUM_LIT:1>, <NUM_LIT:2>):<EOL><INDENT>global_settings.DATABASES = {<EOL>'<STR_LIT:default>': {<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': os.path.join(BASE_PATH, '<STR_LIT>'),<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>}<EOL>}<EOL><DEDENT>else:<EOL><INDENT>global_settings.DATABASE_ENGINE = "<STR_LIT>"<EOL>global_settings.DATABASE_NAME = "<STR_LIT>"<EOL><DEDENT>global_settings.MIDDLEWARE_CLASSES = (<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'<EOL>)<EOL>global_settings.CONSTANT_CONTACT_API_KEY = os.environ.get(<EOL>'<STR_LIT>', None)<EOL>global_settings.CONSTANT_CONTACT_ACCESS_TOKEN = os.environ.get(<EOL>'<STR_LIT>', None)<EOL>global_settings.CONSTANT_CONTACT_FROM_EMAIL = os.environ.get(<EOL>'<STR_LIT>', None)<EOL>global_settings.CONSTANT_CONTACT_REPLY_TO_EMAIL = os.environ.get(<EOL>'<STR_LIT>', None)<EOL>global_settings.CONSTANT_CONTACT_USERNAME = os.environ.get(<EOL>'<STR_LIT>', None)<EOL>global_settings.CONSTANT_CONTACT_PASSWORD = os.environ.get(<EOL>'<STR_LIT>', None)<EOL>global_settings.SECRET_KEY = "<STR_LIT>"<EOL>from django.test.utils import get_runner<EOL>test_runner = get_runner(global_settings)<EOL>django.setup()<EOL>if django.VERSION > (<NUM_LIT:1>, <NUM_LIT:2>):<EOL><INDENT>test_runner = test_runner()<EOL>failures = test_runner.run_tests(['<STR_LIT>', ])<EOL><DEDENT>else:<EOL><INDENT>failures = test_runner(['<STR_LIT>', ], verbosity=<NUM_LIT:1>)<EOL><DEDENT>sys.exit(failures)<EOL>
Standalone django model test with a 'memory-only-django-installation'.
You can play with a django model without a complete django app installation
http://www.djangosnippets.org/snippets/1044/