I've run into two problems when moving my Django app from the dev server to a production one (Apache). I'm assuming both may have something to do with my Apache configuration. Any help would be great.
(1) I'm using the jQuery-based Elfinder filebrowser with yawd-elfinder connector. On the dev server I can browse files with chinese characters just fine, but on the Apache server Elfinder gives me an error:
Unable to open "Folder_Name". ascii File_name_with_chinese_ characters.doc ordinal not in range(128)
I made sure the Apache config has the UTF-8 CharacterSet selected. A post here says something similar may be caused by a Locale issue... but I'm not really sure how to approach that type of problem. Any ideas/suggestions? (You'll see a reference in there to yawd-elfinder specifically... my version has that patch)
(2) I'm using Haystack + Solr for search capability. Search only works if I change 127.0.0.1 to the machine's IP.
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr/test_core_django2'
},
On the dev server it was fine as 127.0.0.1. This one isn't as big an issue as I found a workaround, but it's a bit confusing for me
In case anybody else runs into the same problem, I found that Apache was overriding the locale settings. Thanks to luke_aus above, I printed out locale settings on both Apache and dev... the Apache/mod_wsgi instance output as ascii.
This link covers how to fix it:
http://blog.dscpl.com.au/2014/09/setting-lang-and-lcall-when-using.html
Specifically:
WSGIDaemonProcess my-django-site lang='en_US.UTF-8' locale='en_US.UTF-8'
Note that this only works if you are running wsgi in Daemon mode.