Deploying LFS with FCGI

31 views
Skip to first unread message

Nicole Mattson

unread,
Nov 2, 2015, 12:01:02 PM11/2/15
to django-lfs
My hosting company uses FCGI for Django deployments, which I know is not optimal (and will be removed in Django 1.9).  I would still like to be able to deploy LFS with them if at all possible.  I have been able to get a standard Django deployment to work on their shared hosting here.  Here are their Django installation instructions: https://www.a2hosting.com/kb/developer-corner/python/installing-and-configuring-django-with-fastcgi-on-shared-hosting

However, every time I try to get LFS working, I get these 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!

Before I can do step 6 of the LFS installation instructions (syncing the database) I run python application.fcgi to see if it's working, and it never does.

My virtualenv is called devstore, and I am trying to get it installed on a subdomain called dev-store

Here is my .htaccess file:

AddHandler fcgid-script .fcgi
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(adminmedia/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(cgi-bin/application.fcgi)
RewriteRule ^(.*)$ cgi-bin/application.fcgi/$1 [L]

And here is my application.fcgi file:

#!/home/tentsand/devstore/bin/python

# Set up the virtual environment:
import os, sys
os.environ.setdefault('PATH', '/bin:/usr/bin')
os.environ['PATH'] = '/home/tentsand/devstore/bin:' + os.environ['PATH']
os.environ['VIRTUAL_ENV'] = '/home/tentsand/devstore/bin'
os.environ['PYTHON_EGG_CACHE'] = '/home/tentsand/devstore/bin'
os.chdir('/home/tentsand/public_html/dev-store/lfs-installer')

# Add a custom Python path.
sys.path.insert(0, "/home/tentsand/public_html/dev-store/lfs-installer")

# Set the DJANGO_SETTINGS_MODULE environment variable to the file in the
# application directory with the db settings etc.
os.environ['DJANGO_SETTINGS_MODULE'] = "lfs_project.settings"

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

Can anybody see what I'm doing wrong here?  I have tried changing my paths to a few different things, and this gets me the closest to working.  Anything else returns a "lfs_project.settings not found" error.

Thanks! 

Noe Nieto

unread,
Nov 2, 2015, 12:23:56 PM11/2/15
to djang...@googlegroups.com
Is there any error? If not, what is it doing and what it should do?

Have you looked at apache's access log and error log?

--
Noe

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



--
---
Noe Nieto
NNieto Consulting Services
M: nni...@noenieto.com
W: http://noenieto.com
T:  @tzicatl
Li: Perfil en LinkedIn

Nicole Mattson

unread,
Nov 2, 2015, 12:31:31 PM11/2/15
to django-lfs
I get those WSGI errors when I run python application.fcgi, and then when I browse to the URL either it can't find the urls.py file or it can't connect to the database, depending on what I have in my application.fcgi file.

The error log is empty.  The access log doesn't have anything but my GET requests in it.
Message has been deleted

Nicole Mattson

unread,
Nov 2, 2015, 12:33:40 PM11/2/15
to django-lfs
I should add--I am getting a 500 error when I run python application.fcgi, along with the WSGI errors.

Noe Nieto

unread,
Nov 2, 2015, 1:20:16 PM11/2/15
to djang...@googlegroups.com
Is mod_wsgi installed on you server?

--
Noe

Nicole Mattson

unread,
Nov 2, 2015, 1:43:00 PM11/2/15
to django-lfs
It's a shared hosting environment, so I'm not sure how to check that, but when I install a basic Django instance, that works fine with no errors.
Reply all
Reply to author
Forward
0 new messages