djangosnippets.org: Latest snippets tagged with 'fcgi'https://djangosnippets.org/tags/fcgi/2011-03-11T10:22:30.447782-06:00Make runfcgi fail when database connection is open before fork
2011-03-11T10:22:30.447782-06:00mpasternackihttps://djangosnippets.org/snippets/2390/<p>FastCGI handler in prefork mode first imports every application, then forks. If any application during import opens connection to database, open connection is inherited by all of child processes; open db connection cannot be shared between processes, and if one process sends a request, another can receive a reply; also, …</p>
Freely redistributableOpenSolaris SMF Django Daemon Script
2009-07-10T12:22:18.030119-05:00davidblewetthttps://djangosnippets.org/snippets/1623/<p>This is the manifest for being able to start django daemons via django-admin. A sample instance ('signet') is included.</p>
Freely redistributableSimple FastCGI authorizer view
2008-10-23T03:46:50.530779-05:00cmehttps://djangosnippets.org/snippets/1150/<p>This is a basic view for a FastCGI authorizer against the Django auth. The idea is to return either a blank response with REMOTE_USER set on success, a forbidden response for failure, or a redirect to a login page when no user is logged in.</p>
<p>I use this view for …</p>
Freely redistributableRun Django as a FastCGI authorizer
2008-10-23T03:36:38.184924-05:00cmehttps://djangosnippets.org/snippets/1149/<p>I use this as the FastCGI script for authorizers with lighttpd (though I guess it should work with little change on any other webserver supporting FastCGI). I point it to the same Django project/settings as the normal responder script.</p>
<p>As I use it to gate access to pages not served …</p>
Freely redistributableFreeBSD rc.d FastCGI Script
2008-09-12T06:56:32.152487-05:00davidblewetthttps://djangosnippets.org/snippets/1050/<p>This is a simple rc script, suitable for starting a FastCGI daemon on FreeBSD. Simply copy this into /usr/local/etc/rc.d , change all references to "signet" to the name of your app, mark it executable and modify /etc/rc.conf accordingly.</p>
Freely redistributableControl FCGI processes through management
2008-03-27T18:31:41.488708-05:00nipuLhttps://djangosnippets.org/snippets/670/<p>Add fcgi to settings.INSTALLED_APPS then you can start and stop FCGI through manage.py</p>
<blockquote>
<p>python manage.py startfcgi</p>
<p>python manage.py stopfcgi</p>
</blockquote>
<p>In settings define runfcgi arguments using <strong>FCGI_</strong>* in settings</p>
<p>For example:</p>
<blockquote>
<p>FCGI_SOCKET='/var/tmp/project.sock'
FCGI_PIDFILE='/var/run/project.pid'</p>
</blockquote>
<p>One of <strong>FCGI_SOCKET</strong> or <strong>FCGI_HOST</strong>/<strong>FCGI_PORT</strong> will need to be defined, but if you forget they …</p>
Freely redistributableLogging solution for mod_python/FCGI
2007-09-18T14:11:29.683282-05:00mikeivanovhttps://djangosnippets.org/snippets/421/<p>The solution is based on <a href="http://www.djangosnippets.org/snippets/420/">dballanc's snippet</a>.</p>
<p>Can easily be combined with any of the <a href="http://www.djangosnippets.org/tags/debug/">SQL tracing solutions</a>.</p>
<p>You might want to run a separate logging server and redirect your logs there. Please refer to the <a href="http://docs.python.org/lib/module-logging.html">logging reference manual</a>.</p>
Freely redistributable