title: How to set page load time out in django
body: <p>I tried to set page load time out for Django and I come across two ways and there Problems
  In the models I have function that use external module function sometimes that module function calculation time may take more then 1 minute so I want to limit that time</p>
  
  <ol>
  <li>with python signal but signal command will not run unless the thread is a main thread </li>
  <li>after reading the Django documentation I tried to use the TIME_OUT variable in the settings.py but it didn't affect anything </li>
  </ol>
  
  <p>Views.py : </p>
  
  <pre><code>from django.shortcuts import render_to_response
  from web.models import SomeClass
  instance = SomeClass()
  
  def get_service(request):
      service_instance.some_func()
      return render_to_response('get.html', dic, context_instance=RequestContext(request))
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>from x import y
  temp = y()
  class SomeClass():
      def some_func(self):
          temp.do_somthing()
  </code></pre>
  
  <p>settings.py:</p>
  
  <pre><code>"""
  Django settings for webservice project.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/1.6/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/1.6/ref/settings/
  """
  
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  import os
  BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  #DEBUG = False
  TEMPLATE_DEBUG = DEBUG
  TIME_OUT = 2 
  ALLOWED_HOSTS = ['*']
  
  SETTINGS_PATH = os.path.normpath(os.path.dirname(__file__))
  
  TEMPLATE_DIRS = (
      os.path.join(SETTINGS_PATH, 'templates'),
  )
  
  # List of callables that know how to import templates from various sources.
  TEMPLATE_LOADERS = (
      'django.template.loaders.filesystem.Loader',
      'django.template.loaders.app_directories.Loader',
  
  #     'django.template.loaders.eggs.Loader',
  )
  # Application definition
  INSTALLED_APPS = (
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  )
  
  MIDDLEWARE_CLASSES = (
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
  )
  
  ROOT_URLCONF = 'webservice.urls'
  
  WSGI_APPLICATION = 'webservice.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
      }
  }
  
  # Internationalization
  # https://docs.djangoproject.com/en/1.6/topics/i18n/
  
  LANGUAGE_CODE = 'en-us'
  
  TIME_ZONE = 'UTC'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/1.6/howto/static-files/
  
  STATIC_URL = '/static/'
  </code></pre>
  
  <p>I want to build time out for the some_func function or better to limit the page load time in django settings 
  the main problems is that some_func call another module so i can't use loop while with time.time because after 
  If anyone knows the idea or the way to solve this problem I will be very appreciated  </p>
  
  <p>I'm using python 2.7 and Django 1.6</p>