Like this: 'default': { 'ENGINE': '...', 'OPTIONS': { 'threaded': True } }
21.3.2012 11:05, Another Django Newbie kirjoitti:
On Wednesday, March 21, 2012 7:18:16 AM UTC, Jani Tiainen wrote: 20.3.2012 16:45, Another Django Newbie kirjoitti: > > > On Tuesday, March 20, 2012 10:28:49 AM UTC, Another Django Newbie wrote: > > > > On Tuesday, March 20, 2012 10:01:36 AM UTC, Tom Evans wrote: > > On Mon, Mar 19, 2012 at 5:24 PM, Jani Tiainen <xxxxxxxxxxxxxx> > 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 > > > > 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 <http://djangosnippets.org> > <http://djangosnippets.org/snippets/1307/ <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 ....* > > 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. > https://docs.djangoproject.com/en/1.3/ref/databases/#threaded-option <https://docs.djangoproject.com/en/1.3/ref/databases/#threaded-option> Maybe you need to do that.... -- Jani Tiainen 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 -- 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. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.