Problem with tuncated Admin pages in apache + mod_fcgid

66 views
Skip to first unread message

Another Django Newbie

unread,
Mar 15, 2012, 1:05:53 PM3/15/12
to Django users
Hi,

I've just started playing with django this week and was following the
example in the Django Book.

I created an example of my own, based on the models.py in the book and
tested it with manage.py runserver. All worked OK, but when I try it
in apache one of my admin pages is truncated - a number of fields are
left off and there is no Save button. The exact number of fields
truncated depends on whether I use Add from the main page or from the
Add page of another field (so that the affected page is a pop-up)

Apache 2.4.1
mod_fcgid 2.3.6
django 1.3.1
Python 2.7.2
cx-Oracle 5.1.1

Has anyone seen this behaviour? I've looked in apache and django logs
but don't see anything recorded when the page loads. Any ideas greatly
appreciated.

Thanks.

Another Django Newbie

unread,
Mar 19, 2012, 5:04:25 PM3/19/12
to django...@googlegroups.com

Bump .... I've had no luck with this and would still appreciate some pointers! I've tried re-arranging the order of statements in my model code without any improvement.




 

Jani Tiainen

unread,
Mar 19, 2012, 5:24:51 PM3/19/12
to django...@googlegroups.com
Hi,

Since we use same setup except one part: we use mod_wsgi instead of mod_fcgi.

(Since wsgi is considered to be defacto protocol). Could you try to use it?


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/asZ5sigBBuQJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Tom Evans

unread,
Mar 20, 2012, 10:01:36 AM3/20/12
to django...@googlegroups.com
On Mon, Mar 19, 2012 at 5:24 PM, Jani Tiainen <red...@gmail.com> wrote:
> Hi,
>
> Since we use same setup except one part: we use mod_wsgi instead of
> mod_fcgi.
>
> (Since wsgi is considered to be defacto protocol). Could you try to use it?
>

WSGI is the de-facto for hosting python in web servers. If you aren't
running just python, it's nice to use the same hosting mechanism for
all your apps, and fastcgi is a supported mechanism.

OP: You mention using mod_fcgid, but you do not give us any idea of
how you are using mod_fcgid. Configuration and error logs please. FYI,
we run django quite happily under mod_fastcgi.

Cheers

Tom

Another Django Newbie

unread,
Mar 20, 2012, 10:28:49 AM3/20/12
to django...@googlegroups.com


On Tuesday, March 20, 2012 10:01:36 AM UTC, Tom Evans wrote:


Hi Tom,  Jani,

Currently struggling to compile mod_wsgi, or more specifically a shared library version of python - something to do with mismatched 32/64 bit libraries I think.

Here's an extract from httpd.conf.

RewriteEngine On
RewriteRule ^.*/cfServer/(.*)$ /cgi-bin/django.cgi/$1 [PT]
<Directory "/usr/local/apache2/cgi-bin">
    Options ExecCGI
    AddHandler fcgid-script .cgi
    # AddHandler cgi-script .cgi
    Require all granted
</Directory>

and the relevant django.cgi

#!/usr/local/bin/python
from FcgiWsgiAdapter import list_environment, serve_wsgi

import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'cfServer.settings'
os.environ['ORACLE_HOME'] = '/oracle/11gStdEd'

from django.core.handlers.wsgi import WSGIHandler

# use this to test that fastcgi works and to inspect the environment
# serve_wsgi(list_environment)
# use this to serve django
serve_wsgi(WSGIHandler())

The "FcgiWsgiAdapter" referred to came from djangosnippets.org.

As to error logs, as I mentioned in the original post I don't see anything added to any logs when this happens and there is only a warning about the ssl library when apache is restarted.

Regards, ADN

Another Django Newbie

unread,
Mar 20, 2012, 2:45:13 PM3/20/12
to django...@googlegroups.com


So I swapped to using WSGI with this apache config ....

WSGIScriptAlias / /home/user/python/djcode/cfServer/apache/django.wsgi
WSGIDaemonProcess site-1 threads=30
WSGIProcessGroup site-1

<Directory "/home/user/python/djcode/cfServer/apache">
    AllowOverride None
    Options None
    Require all granted
</Directory>

and this django.wsgi

import os, sys
sys.path.append('/home/user/python/djcode')

os.environ['DJANGO_SETTINGS_MODULE'] = 'cfServer.settings'
os.environ['ORACLE_HOME'] = '/oracle/11gStdEd'
os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

and I get segmentation faults (debug level tracing from apache error log)

[Tue Mar 20 14:16:28.126341 2012] [core:notice] [pid 17487:tid 47401308446624] AH00051: child pid 17490 exit signal Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump
[Tue Mar 20 14:16:28.126385 2012] [:info] [pid 17487:tid 47401308446624] mod_wsgi (pid=17490): Process 'site-2' has died, deregister and restart it.
[Tue Mar 20 14:16:28.126394 2012] [:info] [pid 17487:tid 47401308446624] mod_wsgi (pid=17490): Process 'site-2' has been deregistered and will no longer be monitored.
[Tue Mar 20 14:16:28.126826 2012] [:info] [pid 17846:tid 47401308446624] mod_wsgi (pid=17846): Starting process 'site-2' with uid=48, gid=48 and threads=25.
[Tue Mar 20 14:16:28.127268 2012] [:info] [pid 17846:tid 47401308446624] mod_wsgi (pid=17846): Initializing Python.

Back trace on core file ...

Core was generated by `/usr/local/apache2/bin/httpd -k start'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000036422cb2e6 in poll () from /lib64/libc.so.6
(gdb) bt
#0  0x00000036422cb2e6 in poll () from /lib64/libc.so.6
#1  0x00002b1c7a05dd79 in apr_poll (aprset=0x7fff13f01e40, num=1,
    nsds=0x7fff13f01e94, timeout=0) at poll/unix/poll.c:120
#2  0x00002b1c7d5166d3 in wsgi_daemon_main (p=0x1257a138, daemon=0x12696218)
    at mod_wsgi.c:11330
#3  0x00002b1c7d51851f in wsgi_start_process (p=0x1257a138, daemon=0x12696218)
    at mod_wsgi.c:11969
#4  0x00002b1c7d518f50 in wsgi_start_daemons (pconf=0x1257a138,
    ptemp=<value optimized out>, plog=<value optimized out>,
    s=<value optimized out>) at mod_wsgi.c:12181
#5  wsgi_hook_init (pconf=0x1257a138, ptemp=<value optimized out>,
    plog=<value optimized out>, s=<value optimized out>) at mod_wsgi.c:13755
#6  0x0000000000444c2c in ap_run_post_config (pconf=0x1257a138,
    plog=0x125df538, ptemp=0x125a5348, s=0x125a3508) at config.c:101
#7  0x0000000000428734 in main (argc=3, argv=0x7fff13f02498) at main.c:765



Using WSGI briefly solved the original problem, in that I could see the complete admin page that was previously truncated but now nothing works - I get internal server error for all pages on the server.

Regards, ADN

Jani Tiainen

unread,
Mar 21, 2012, 7:18:16 AM3/21/12
to django...@googlegroups.com
> <http://djangosnippets.org/snippets/1307/>.

>
> As to error logs, as I mentioned in the original post I don't see
> anything added to any logs when this happens and there is only a
> warning about the ssl library when apache is restarted.
>
> Regards, ADN
>
>
>
> *So I swapped to using WSGI with this apache config ....*

https://docs.djangoproject.com/en/1.3/ref/databases/#threaded-option

Maybe you need to do that....

--

Jani Tiainen

Another Django Newbie

unread,
Mar 21, 2012, 9:05:03 AM3/21/12
to django...@googlegroups.com


Hi Jani,

Yes I spotted that yesterday, although it's not to clear where it should be placed. Does it go inside the default{} or inside the DATABASES{}?

Thanks, ADN

Jani Tiainen

unread,
Mar 21, 2012, 10:29:48 AM3/21/12
to django...@googlegroups.com
Like this:

'default': {
'ENGINE': '...',
'OPTIONS': {
'threaded': True
}
}

> > <http://djangosnippets.org/snippets/1307/

> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/django-users/-/3IL_wV5HqmwJ.

Another Django Newbie

unread,
Mar 21, 2012, 2:11:58 PM3/21/12
to django...@googlegroups.com


On Wednesday, March 21, 2012 10:29:48 AM UTC, Jani Tiainen wrote:
Like this:

'default': {
   'ENGINE': '...',
   'OPTIONS': {
      'threaded': True
   }
}


Thanks again Jani, switching my question to the modwsgi group ....

Regards, ADN
 


Reply all
Reply to author
Forward
0 new messages