Re: FastCGI Problems

100 views
Skip to first unread message

Newt

unread,
Jul 17, 2012, 6:00:11 PM7/17/12
to django...@googlegroups.com
Finally got everything tweaked (sort of).

I needed to add a RewriteBase directive to .htaccss, amend httpd.conf to use FastCGIServer and not FAstCGIEXternalServer.

That then gave me bind permission denied errors, which I was only able to resolve by putting selinux into permissive mode, which I'm not entirely happy about.

N.

On Tuesday, 17 July 2012 22:00:33 UTC+1, Newt wrote:
I've spent a little more time on this, and I've been trying out python mysite.fcgi

I've now got:

os.environ["DJANGO_SETTINGS_MODULE"] = "settings"

That seems to get python mysite.fcgi, to work better, but I now have errors:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!

I'm hoping that once I have those resolved so that python mysite.fcgi runs with no errors, then perhaps the website will also work...

N.

On Tuesday, July 17, 2012 12:01:00 AM UTC+1, Jarrett Chisholm wrote:
Hey Newt,

not sure if this is your problem, but I think

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

should be

os.environ["DJANGO_SETTINGS_MODULE"] = "proj1.settings"

good luck

On Saturday, 14 July 2012 14:05:35 UTC-4, Newt wrote:
(Sorry if this is a repost - it isn't showing up in the groups for me)

I've tried to set up Django to use a sub-directory on my local PC - I'm using Apache2.0.

This is the relevant part from httpd.conf:

Alias /django /stuff/django/proj1/proj1

<Directory /stuff/django/proj1/proj1>
        Options +execCGI
        AllowOverride FileInfo
        Order allow,deny
        Allow from all
</Directory>

This is from .htaccess:

  AddHandler fastcgi-script .fcgi 

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

And this is mysite.fcgi

#!/usr/bin/python

import os,sys

#sys.path.insert(0, "/stuff/django/proj1/proj1")
sys.path.append('/stuff/django/proj1')
sys.path.append('/stuff/django/proj1/proj1')
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj1.settings")

os.chdir("/stuff/django/proj1/proj1")

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

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

However, accessing http://localhost/django gives:

Not Found

The requested URL /stuff/django/proj1/proj1/mysite.fcgi/ was not found on this server.


Apache/2.2.15 (Scientific Linux) Server at localhost Port 80

Can anyone spot what I've got configured wrongly?

TIA, N.

On Tuesday, 17 July 2012 22:00:33 UTC+1, Newt wrote:
I've spent a little more time on this, and I've been trying out python mysite.fcgi

I've now got:

os.environ["DJANGO_SETTINGS_MODULE"] = "settings"

That seems to get python mysite.fcgi, to work better, but I now have errors:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!

I'm hoping that once I have those resolved so that python mysite.fcgi runs with no errors, then perhaps the website will also work...

N.

On Tuesday, July 17, 2012 12:01:00 AM UTC+1, Jarrett Chisholm wrote:
Hey Newt,

not sure if this is your problem, but I think

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

should be

os.environ["DJANGO_SETTINGS_MODULE"] = "proj1.settings"

good luck

On Saturday, 14 July 2012 14:05:35 UTC-4, Newt wrote:
(Sorry if this is a repost - it isn't showing up in the groups for me)

I've tried to set up Django to use a sub-directory on my local PC - I'm using Apache2.0.

This is the relevant part from httpd.conf:

Alias /django /stuff/django/proj1/proj1

<Directory /stuff/django/proj1/proj1>
        Options +execCGI
        AllowOverride FileInfo
        Order allow,deny
        Allow from all
</Directory>

This is from .htaccess:

  AddHandler fastcgi-script .fcgi 

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

And this is mysite.fcgi

#!/usr/bin/python

import os,sys

#sys.path.insert(0, "/stuff/django/proj1/proj1")
sys.path.append('/stuff/django/proj1')
sys.path.append('/stuff/django/proj1/proj1')
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj1.settings")

os.chdir("/stuff/django/proj1/proj1")

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

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

However, accessing http://localhost/django gives:

Not Found

The requested URL /stuff/django/proj1/proj1/mysite.fcgi/ was not found on this server.


Apache/2.2.15 (Scientific Linux) Server at localhost Port 80

Can anyone spot what I've got configured wrongly?

TIA, N.

On Tuesday, 17 July 2012 22:00:33 UTC+1, Newt wrote:
I've spent a little more time on this, and I've been trying out python mysite.fcgi

I've now got:

os.environ["DJANGO_SETTINGS_MODULE"] = "settings"

That seems to get python mysite.fcgi, to work better, but I now have errors:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!

I'm hoping that once I have those resolved so that python mysite.fcgi runs with no errors, then perhaps the website will also work...

N.

On Tuesday, July 17, 2012 12:01:00 AM UTC+1, Jarrett Chisholm wrote:
Hey Newt,

not sure if this is your problem, but I think

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

should be

os.environ["DJANGO_SETTINGS_MODULE"] = "proj1.settings"

good luck

On Saturday, 14 July 2012 14:05:35 UTC-4, Newt wrote:
(Sorry if this is a repost - it isn't showing up in the groups for me)

I've tried to set up Django to use a sub-directory on my local PC - I'm using Apache2.0.

This is the relevant part from httpd.conf:

Alias /django /stuff/django/proj1/proj1

<Directory /stuff/django/proj1/proj1>
        Options +execCGI
        AllowOverride FileInfo
        Order allow,deny
        Allow from all
</Directory>

This is from .htaccess:

  AddHandler fastcgi-script .fcgi 

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

And this is mysite.fcgi

#!/usr/bin/python

import os,sys

#sys.path.insert(0, "/stuff/django/proj1/proj1")
sys.path.append('/stuff/django/proj1')
sys.path.append('/stuff/django/proj1/proj1')
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj1.settings")

os.chdir("/stuff/django/proj1/proj1")

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

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

However, accessing http://localhost/django gives:

Not Found

The requested URL /stuff/django/proj1/proj1/mysite.fcgi/ was not found on this server.


Apache/2.2.15 (Scientific Linux) Server at localhost Port 80

Can anyone spot what I've got configured wrongly?

TIA, N.

On Tuesday, 17 July 2012 22:00:33 UTC+1, Newt wrote:
I've spent a little more time on this, and I've been trying out python mysite.fcgi

I've now got:

os.environ["DJANGO_SETTINGS_MODULE"] = "settings"

That seems to get python mysite.fcgi, to work better, but I now have errors:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!

I'm hoping that once I have those resolved so that python mysite.fcgi runs with no errors, then perhaps the website will also work...

N.

On Tuesday, July 17, 2012 12:01:00 AM UTC+1, Jarrett Chisholm wrote:
Hey Newt,

not sure if this is your problem, but I think

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

should be

os.environ["DJANGO_SETTINGS_MODULE"] = "proj1.settings"

good luck

On Saturday, 14 July 2012 14:05:35 UTC-4, Newt wrote:
(Sorry if this is a repost - it isn't showing up in the groups for me)

I've tried to set up Django to use a sub-directory on my local PC - I'm using Apache2.0.

This is the relevant part from httpd.conf:

Alias /django /stuff/django/proj1/proj1

<Directory /stuff/django/proj1/proj1>
        Options +execCGI
        AllowOverride FileInfo
        Order allow,deny
        Allow from all
</Directory>

This is from .htaccess:

  AddHandler fastcgi-script .fcgi 

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

And this is mysite.fcgi

#!/usr/bin/python

import os,sys

#sys.path.insert(0, "/stuff/django/proj1/proj1")
sys.path.append('/stuff/django/proj1')
sys.path.append('/stuff/django/proj1/proj1')
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj1.settings")

os.chdir("/stuff/django/proj1/proj1")

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

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

However, accessing http://localhost/django gives:

Not Found

The requested URL /stuff/django/proj1/proj1/mysite.fcgi/ was not found on this server.


Apache/2.2.15 (Scientific Linux) Server at localhost Port 80

Can anyone spot what I've got configured wrongly?

TIA, N.
Reply all
Reply to author
Forward
0 new messages