Hello. I have this view which generates interface language options menu
def lang_menu(request,language):
lang_choices = []
import os.path
for lang in settings.LANGUAGES:
if os.path.isfile("gui/%s.py" % lang) or os.path.isfile("gui/%s.pyc" % lang):
langimport = "from gui.%s import menu" % lang
try:
exec(langimport)
except ImportError:
lang_choices.append({'error':'invalid language file'})
else:
lang_choices.append(menu)
else:
lang_choices.append({'error':'lang file not found'})
t = loader.get_template('gui/blocks/lang_menu_options.html')
data = ''
for lang in lang_choices:
if not 'error' in lang:
data = "%s\n%s" % (data,t.render(Context(lang)))
if not data:
data = "Error! No languages configured or incorrect language files!"
return Context({'content':data})
When I'am using development server (python manage.py runserver ...
) it works fine. But when I ported my app to apache wsgi server I've got error "No languages configured or incorrect language files!
"
Here is my Apache config
<VirtualHost *:9999>
WSGIScriptAlias / "/usr/local/etc/django/terminal/django.wsgi"
<Directory "/usr/local/etc/django/terminal">
Options +ExecCGI
Allow From All
</Directory>
Alias /media/ "/usr/local/lib/python2.5/site-packages/django/contrib/admin/media/"
<Location /media/>
SetHandler None
</Location>
<Directory "/usr/local/lib/python2.5/site-packages/django/contrib/admin/media/>
Allow from all
</Directory>
Alias /static/ "/usr/local/etc/django/terminal/media/"
<Location /static/>
SetHandler None
</Location>
ServerName *******
ServerAlias *******
ErrorLog /var/log/django.error.log
TransferLog /var/log/django.access.log
</VirtualHost>
django.wsgi:
import os, sys
sys.path.append('/usr/local/etc/django')
sys.path.append('/usr/local/etc/django/terminal')
os.environ['DJANGO_SETTINGS_MODULE'] = 'terminal.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
It's look like as problem with path configuration but I'm stuck here ...