#14138: Apache setup using sqlite3 breaks when performing a field__regex filter
--------------------------------------------------------+-------------------
               Reporter:  eternicode                    |         Owner:  
nobody                                             
                 Status:  closed                        |     Milestone:        
                                             
              Component:  Database layer (models, ORM)  |       Version:  1.2   
                                             
             Resolution:  worksforme                    |      Keywords:  
sqlite3 apache operationalerror databaseerror regex
           Triage Stage:  Unreviewed                    |     Has patch:  0     
                                             
    Needs documentation:  0                             |   Needs tests:  0     
                                             
Patch needs improvement:  0                             |  
--------------------------------------------------------+-------------------
Changes (by Sashan <anedvedicky@…>):

  * version:  1.1 => 1.2


Comment:

 I've hit same problem after upgrading lenny to debian:
         django-1.1 -> django-1.2.4;
         python2.4 -> python2.6
 The workaround proposed by eternicode really works, which is big mystery
 to me.

 I've noticed the statement 'import re' is used at the beginning of
 db.backends.sqlite3.base module. So I've just removed 'import re' line in
 _sqlite_regex() function.

 Once workaround has been applied, it started to work, until I've hit
 another
 problem with url reverse.  All templates, which are using url tag fail
 with
 'Caught ImportError while rendering: No module named urls' exception.
 Everything points towards apache misconfiguration or upgrade path.

 I'm using wsgi module 3.3.  My apache config follows further below. Any
 help very appreciated. I suspect I need to tune environment a bit, but
 I have no idea where to start. Thanks in advance for any hint.

 --- cut here to get /etc/apache2/envvars ----
 {{{
 # envvars - default environment variables for apache2ctl

 # this won't be correct after changing uid
 unset HOME

 # for supporting multiple apache2 instances
 if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
         SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
 else
         SUFFIX=
 fi

 # Since there is no sane way to get the parsed apache2 config in scripts,
 some
 # settings are defined via environment variables and then used in
 apache2ctl,
 # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
 export APACHE_RUN_USER=www-data
 export APACHE_RUN_GROUP=www-data
 export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid
 export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
 export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
 # Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
 export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

 ## The locale used by some modules like mod_dav
 export LANG=C
 ## Uncomment the following line to use the system default locale instead:
 #. /etc/default/locale

 export LANG

 ## The command to get the status for 'apache2ctl status'.
 ## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
 #export APACHE_LYNX='www-browser -dump'

 }}}
 --- cut here to get /etc/sites-enabled/www-site ----
 {{{
 <VirtualHost *:80>
         ServerName www.example.com
         WSGIScriptAlias /       /srv/example/django.wsgi
 </VirtualHost>
 }}}
 --- cut here to get /etc/sites-enabled/media ----
 {{{
 <VirtualHost *:80>
         ServerName media.example.com
         DocumentRoot /srv/media
         <Directory *>
                 Options -Indexes
         </Directory>
 </VirtualHost>
 }}}
 --- cut here to get /srv/example/django.wsgi ----
 {{{
 import os
 import sys

 sys.stdout = sys.stderr
 #sys.path.append('/srv/')
 sys.path.append('/srv/parliament-poll-stats/')
 #sys.path.append('/srv/parliament-poll-stats/json')
 #sys.path.append('/srv/parliament-poll-stats/utils')
 os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

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

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14138#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to