jaysonpryde
jaysonpryde

Reputation: 2813

Django: Deploying application using Apache and FastCGI

I've been following the book "The Definitive guide to Django" to create a web application. So far so good and soon, I'll be deploying the application on production. I am targeting the usage of Apache + FastCGI specified on the book. I am able to follow the initial setup indicated in the book. (i.e install Apache, install mod_fastcgi and edit httpd.conf). The next step indicated is "Specifying the Location of the FastCGI server". There are 2 steps which are (1)Use the FastCGIExternalServer directive to specify the location of your FastCGI server and (2)Use mod_rewrite to point URLs at FastCGI as appropriate.

This is where I got lost. I don't know if I will just add the following lines again to httpd.conf:

# Connect to FastCGI via a socket/named pipe:
FastCGIExternalServer /home/user/public_html/mysite.fcgi -socket /home/user/mysite.sock
# Connect to FastCGI via a TCP host/port:
FastCGIExternalServer /home/user/public_html/mysite.fcgi -host 127.0.0.1:3033

If not, how should I proceed on this? Hoping to hear any ideas. Thank you very much in advance!

Upvotes: 2

Views: 404

Answers (1)

Andrew Gorcester
Andrew Gorcester

Reputation: 19953

I am not familiar with FastCGI myself (I have used Apache's mod_wsgi and gunicorn in the past, and will probably use gunicorn in the future) but it looks like you only need one of those lines. Preferably the top one using the socket.

Which file you add it to exactly depends on your specific Linux distribution. I would recommend not using your book for advice on how to serve django, because online tutorials specific to a linux distribution (for instance, this Linode help article on how to install django on Ubuntu 10.04 with mod_wsgi) will be more up-to-date and more specific. Only try to make sense of a potentially out-of-date book's instructions if you are an experienced system administrator.

Upvotes: 1

Related Questions