LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > CGI/Perl/Python > LSWS and Django

Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2006, 04:42 PM
tpersen tpersen is offline
New Member
 
Join Date: Sep 2006
Posts: 3
Default LSWS and Django

Anyone tried using the python-based Django web framework under Litespeed?

More info at http://www.djangoproject.com/

It's got built-in FCGI support with flup (http://trac.saddi.com/flup), and I've had minimal success running it in threaded mode, and no success running it in prefork mode. When in threaded mode, it serves up pages for a while then returns 503s until I restart the process. Prefork starts up all the processes and then just returns 503s all the time.

On the Django site, they mention that their preferred method of serving is to run apache with mod_python, but I have a feeling Litespeed can outperform it if I can get it running correctly.

Any help is appreciated.
Reply With Quote
  #2  
Old 12-06-2006, 05:00 PM
xing xing is offline
LiteSpeed Staff
 
Join Date: Oct 2003
Location: Los Angeles, California
Posts: 380
tpersen,

Not all FCGI frameworks are created equal.

Try this:

1) Disable "persistent connection" under FCGI extapp.

2) From trac.saddi.com/flup it looks like they support AJP 1.3 interface in-addition to FCGi. Instead of using a FCGI extapp, use a Java/AJP extapp instead.
Reply With Quote
  #3  
Old 12-07-2006, 11:37 PM
tpersen tpersen is offline
New Member
 
Join Date: Sep 2006
Posts: 3
The "persistent connection" setting was already set to N/A. I tried setting it to "no", but it didn't make a difference.

It seems that threaded mode is working alright. I think the reason it fails eventually has to do with the process running in debug mode. I haven't tried disabling debug yet, but I think that's where the problem lies.

In prefork mode, however, I am still not getting anything except 503s. I see all the python processes spawn, the socket is created, but they don't seem to be communicating with litespeed. Any other ideas?

Also, I've only tried on my development machine, which is an iMac. I'll try it on one of my linux servers tomorrow and see if I get any different results. Another alternative is that I could try rewriting their fcgi script to use the libraries you recommended instead if nothing else seems to work.

Todd
Reply With Quote
  #4  
Old 12-16-2006, 09:19 AM
aemadrid aemadrid is offline
Senior Member
 
Join Date: Aug 2006
Posts: 57
Default Any luck?

What were your results? I have been meaning to try Django for some time but the whole install and deployment seem to be a drag. Any luck getting it to run succesfully? Any tips? I'd love to give it a try under LS.

Thanks in advance,

AEM

Quote:
Originally Posted by tpersen View Post
The "persistent connection" setting was already set to N/A. I tried setting it to "no", but it didn't make a difference.

It seems that threaded mode is working alright. I think the reason it fails eventually has to do with the process running in debug mode. I haven't tried disabling debug yet, but I think that's where the problem lies.

In prefork mode, however, I am still not getting anything except 503s. I see all the python processes spawn, the socket is created, but they don't seem to be communicating with litespeed. Any other ideas?

Also, I've only tried on my development machine, which is an iMac. I'll try it on one of my linux servers tomorrow and see if I get any different results. Another alternative is that I could try rewriting their fcgi script to use the libraries you recommended instead if nothing else seems to work.

Todd
Reply With Quote
  #5  
Old 12-16-2006, 12:00 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
Took a brief look at Django document and flup code, I think it should work well with LSWS. Just a little tricky for the FCGI startup command.

If you want LSWS to manage the FCGI instances, you can try:
MaxConn: 20 (<50 is OK, flup support upto 50 connections by default)
Auto Start: true
Command: path_to_manage.py runfcgi daemonize=false (method could be threaded or prefork)
Intance: 1

Make sure you do NOT specify host, port or socket command line option in LSWS managed mode. LSWS will create those sockets.

If you want to start it manually, just set "Auto Start" to false and the follow Django document.
Reply With Quote
  #6  
Old 12-16-2006, 04:39 PM
aemadrid aemadrid is offline
Senior Member
 
Join Date: Aug 2006
Posts: 57
Thanks for the info. I'm always pleasantly surprised by the support in this forum. I gave it a try locally and it looked interesting but I don't think I will be using it in production anytime soon.

Thanks again,


Adrian Madrid

Quote:
Originally Posted by mistwang View Post
Took a brief look at Django document and flup code, I think it should work well with LSWS. Just a little tricky for the FCGI startup command.

If you want LSWS to manage the FCGI instances, you can try:
MaxConn: 20 (<50 is OK, flup support upto 50 connections by default)
Auto Start: true
Command: path_to_manage.py runfcgi daemonize=false (method could be threaded or prefork)
Intance: 1

Make sure you do NOT specify host, port or socket command line option in LSWS managed mode. LSWS will create those sockets.

If you want to start it manually, just set "Auto Start" to false and the follow Django document.
Reply With Quote
  #7  
Old 07-27-2007, 03:39 AM
hvendelbo hvendelbo is offline
New Member
 
Join Date: Nov 2006
Posts: 1
Red face one working setup

If anyone stumble upon this thread.

I have a working setup using the AJP connector.

Initially I used it in threading mode, but I think the session support in django doesn't like that, so I had to switch to forked. The performance hit isn't terrible, but it's still annoying.
Reply With Quote
  #8  
Old 07-27-2007, 08:30 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
How does it compare with other python API interface written in pure python, performance wise?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:11 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.