Have a read of:

    http://blog.dscpl.com.au/2014/09/setting-lang-and-lcall-when-using.html 
<http://blog.dscpl.com.au/2014/09/setting-lang-and-lcall-when-using.html>

about setting lang/locale.

Graham

> On 18 Nov 2017, at 2:23 am, Samuel Bancal <[email protected]> wrote:
> 
> Hi,
> 
> I'm having problems with accented characters in strings.
> 
> Pieces of soft I used is :
> + mod-wsgi 4.5.20 and 4.5.21
> + Python 3.5.2
> + Django 1.8.18 and 1.11.7
> + Apache2 2.4.18
> + Ubuntu 16.04
> 
> 
> The following code in a view doesn't output to the logfile the line with 
> accented characters :
> 
> ~~~ python
> import logging
> 
> from django.shortcuts import render, render_to_response
> 
> def home(request):
>     debug_logger = logging.getLogger("debug")
>     debug_logger.debug('haha')  # this works
>     debug_logger.debug('héhé')  # this is missing !?!
>     debug_logger.debug('huhu')  # this works
>     return render_to_response('home.html', {})
> ~~~
> 
> On the other hand, when I run the same code by hand within :
> 
> $ python manage.py shell
> 
> everything appears in the log file.
> 
> 
> I'm not sure what could be the problem, but since the behaviour is different 
> when launched in Apache/mod-wsgi context than by hand (in Python or in 
> iPython), I guess something has to be elucidate around here.
> 
> Apache's config is the following :
> 
> ~~~
> WSGIDaemonProcess main processes=1 threads=15 
> python-home=/django_app/venv/py3 python-path=/django_app/foo1 
> display-name=%{GROUP}
> WSGIScriptAlias / /django_app/foo1/foo1/wsgi.py
> WSGIApplicationGroup %{GLOBAL}
> WSGIProcessGroup main
> 
> Alias /static/ /django_app/foo1/static/
> 
> <Directory /django_app/foo1/static>
>     Options -Indexes
>     <IfVersion < 2.3>
>         Order deny,allow
>         Allow from all
>     </IfVersion>
>     <IfVersion >= 2.3>
>         Require all granted
>     </IfVersion>
> </Directory>
> 
> <Directory /django_app/foo1/foo1>
>     <Files wsgi.py>
>         <IfVersion < 2.3>
>             Order deny,allow
>             Allow from all
>         </IfVersion>
>         <IfVersion >= 2.3>
>             Require all granted
>         </IfVersion>
>     </Files>
> </Directory>
> ~~~
> 
> and 
> 
> ~~~
> WSGIRestrictEmbedded On
> ~~~
> 
> 
> Best regards,
> Samuel
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to