Search code examples
djangoperformancefastcgi

Django Response Delay for every request


currently, I move my Django application on a production server. The problem is that each request to the server is slower by 1 second, then locallhost. (I don't mean static files. For testing I made ​​a simple VIEW, that not access the database and not contain python code only return string) I did get this values(delay 1 second) ​​of Chrome / Network/ Property - request - Waiting. Property Sending/receiving is normal (cca 1-10ms)

My .htaccess:

AuthType none
Satisfy Any
Allow from All

AddHandler fast-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /mysite.cgi/$1 [QSA,L]

My mysite.cgi:

#!/usr/bin/python
# -*- coding: utf8 -*-
import sys, os

# to suppress browser output, you should explicitly say so.
import cgitb
cgitb.enable(display=True)

# Add a custom Python path.

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ.setdefault("DJANGO_SETTINGS_MODULE","Web.settings")


from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="False")

I'm not server admin, so haven´t permission for setting Apache etc. It is possible that the application not uses FastCGI but CGI? Or something like that?

Thanks


Solution

  • Problem solved by server admin, the server has not installed mod_fcgid.