Ok, so how put django to work? I try early info.

Discussion in 'CGI/Perl/Python' started by mamcx, Feb 15, 2008.

  1. mamcx

    mamcx New Member

    I have the most recent trunk of django. I read the info on this forum and of the wiki.

    However, I keep getting

    503 Service Unavailable

    And this is the error:

    2008-02-15 21:51:21.670 ERROR execle() failed with errno=13, when try to start Fast CGI application: /home/d9a402a6/jhonWeb/paradondevamos/django-fcgi.py!
    2008-02-15 21:51:21.778 INFO Remove pid: 3503
    2008-02-15 21:51:21.778 INFO Pid: 3503 associated with [Paradonde]
    2008-02-15 21:51:21.778 INFO [Paradonde] pid list size: 0, pid stop list size: 0
    2008-02-15 21:51:21.778 NOTICE [Paradonde] stop worker processes
    2008-02-15 21:51:21.779 INFO [Paradonde] 1 request being processed, kill external app later.

    My settings are:

    Name Paradonde
    Address uds://tmp/paradonde.sock
    Notes Not Set
    Max Connections 1
    Environment Not Set
    Initial Request Timeout (secs) 10
    Retry Timeout (secs) 5
    Persistent Connection No
    Connection Keepalive Timeout 30
    Response Buffering No
    Auto Start Yes
    Command /home/d9a402a6/jhonWeb/paradondevamos/django-fcgi.py
    Back Log 50
    Instances 1

    django-fcgi.py:

    import sys, os
    from settings_dev import BASE_DIR
    BASE_DIR = os.path.abspath(os.path.dirname(__file__)+'/../')
    sys.path.append(BASE_DIR)

    os.chdir(BASE_DIR)
    # Set the DJANGO_SETTINGS_MODULE environment variable.
    os.environ['DJANGO_SETTINGS_MODULE'] = "paradondevamos.settings"

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

    Also, I don't can acces this useing the uri '/'. I have a new vhost for this... I must delete the default one?
  2. mamcx

    mamcx New Member

    Also, I get suere the django-fcgy was set to 755 and the owner was www:www the same of the webserver.

    This is running on Joyent accelerator
  3. mistwang

    mistwang LiteSpeed Staff

    error 13 is permission denied. so it is a permission problem.
    Please check the permission of parent directories as well.

    try

    sudo -s <user_name> /home/d9a402a6/jhonWeb/paradondevamos/django-fcgi.py

    make sure it can be started.

    Double check the Memrory Soft/Hard Limit and Process Soft/Hard Limit.
  4. mamcx

    mamcx New Member

    I have nothing in limits.

    I'm on solaris, when I run this:

    sudo -s www /home/d9a402a6/jhonWeb/paradondevamos/django-fcgi.py

    I get:

    www: No such file or directory

    -s is not found.

    I run chown -R www:www jhonWeb (jhonWeb is the parent directory) and using my sftp client see is set ok.

    LiteSpeed is running under: user(www) : group(www)
    Last edited: Feb 15, 2008
  5. mistwang

    mistwang LiteSpeed Staff

    sorry, should be
    sudo -u www ...

    Not sure about solaris, you can check sudo man page.
  6. mamcx

    mamcx New Member

    That not work

    I find this command for solaris:

    ls -l

    and get for all files on my dir:

    -rw-r--r-- 1 www www 408 Feb 15 21:48 django-fcgi.py

    So I confirm all files are set to www.
  7. mistwang

    mistwang LiteSpeed Staff

    You also need to check all the permission of parent directories holding the file.
  8. mamcx

    mamcx New Member

  9. mistwang

    mistwang LiteSpeed Staff

    The script uses
    Code:
    #!/usr/bin/python
    if your python is installed to somewhere else, you should change that.
  10. mamcx

    mamcx New Member

    Almost there!

    Ok, you put me in the right track.

    I change to the harcode python path and work ok (I have python2.4/2.5 both installed, so that must be).

    Also, I change the command, so is now:

    /opt/local/bin/python2.4 /home/d9a402a6/jhonWeb/paradondevamos/manage.py runfcgi method=prefork

    Then I got:

    unpack non-sequence

    And stop when acces

    request.path

    on django.

    I then imagine is because I put this on contect /para/. I move it to '/' but get 404.

    I need to setup rewrite for this?
  11. mistwang

    mistwang LiteSpeed Staff

    You should create a FastCGI context for each URL that should be handled by the framework.
    Handler should be set to the python external app.

    I think you should add "daemonize=false" parameter as well.
  12. mamcx

    mamcx New Member

    No understand. I must map ALL the urls? Included the managed by django itself?

    I have dozens of that! I'm thinking in use litespeed for a medium size community/social site.
  13. mistwang

    mistwang LiteSpeed Staff

  14. triedia09

    triedia09 Guest

    Ok so how put django to work I try early info

    That looks useful... but I dont understand any of this tbh... maybe you can put it in a webpage for me or something so I can use it?
  15. NiteWave

    NiteWave Administrator

Share This Page