Created
February 13, 2011 21:19
-
-
Save reidrac/825144 to your computer and use it in GitHub Desktop.
django fastcgi sig handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys, os | |
import signal | |
quit_requested = False | |
def intSigHandler(signal, frame): | |
quit_requested = True | |
signal.signal(signal.SIGINT, intSigHandler) | |
# Add a custom Python path. | |
sys.path.insert(0, "/home/user/python") | |
# Switch to the directory of your project. (Optional.) | |
# os.chdir("/home/user/myproject") | |
# Set the DJANGO_SETTINGS_MODULE environment variable. | |
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings" | |
from django.core.servers.fastcgi import runfastcgi | |
runfastcgi(method="threaded", daemonize="false") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment