import os,sys,django; sys.path.append("\path\to\mysite")#ATTETION!,Err: "unable to configure filter 'special'django.core.exceptions.ImproperlyConfigured" os.environ["DJANGO_SETTINGS_MODULE"]="mysite.settings"#Attention!Err: 'no handlers could be found for logger "django.request"' django.setup()#ATTETION!,raise django.core.exceptions.ImproperlyConfigured from django.test.utils import setup_test_environment from django.test.client import Client from django.core.urlresolvers import reverse setup_test_environment() client = Client() response = client.get('/')