Friday, March 1, 2013

Re: Daemonize django server

On Thu, Feb 28, 2013 at 6:23 PM, Tim Johnson <tim@akwebsoft.com> wrote:
> I'm having a hell of a time getting fastcgi to work on my mac, so
> for the time being I'll just stick with using the django server.
>
> Is it possible to daemonize the server? I would prefer that in some
> cases.
>
> From https://docs.djangoproject.com/en/dev/ref/django-admin/
> I see daemonize as an option for runfcgi but not for runserver.
>
> thanks

I didn't reply to your fastcgi posts yesterday, as you were attempting
to have everything spawned by the web server, which is not how I have
my fastcgi sites setup. If you are happy with running the web app
separately yourself, then this recipe will work:

Apache httpd with mod_fastcgi:

RewriteCond %{REQUEST_URI} !^/media
RewriteCond %{REQUEST_URI} !^/
# repeat for any other directories you want httpd to serve
RewriteRule ^/(.*)$ /app.fcgi/$1 [QSA,L]
FastCGIExternalServer /path/to/your/htdocs/app.fcgi -socket
/path/to/your/webapp/run/app.socket

Then simply ensure you have started your app:

python project/manage.py runfcgi \
socket=/path/to/your/webapp/run/app.socket \
pidfile=/path/.../run/app.pid \
errlog=... outlog=... \
minspare=.. maxspare=...

For absolute clarity, there is *no* real file named 'app.fcgi'. It
does not exist, it has no contents, it is merely a location in
urlspace - although you specify it as a filespace location! - that is
used to specify to fastcgi to take over the request. This is the
opposite of wsgi!

Is there a reason you are not using wsgi by the way? This is the
preferred method of hosting python apps, we used fastcgi as we are not
only hosting python apps.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment