Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 784471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:43:08+00:00 2026-05-14T20:43:08+00:00

I have this view which generates interface language options menu def lang_menu(request,language): lang_choices =

  • 0

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 …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:43:09+00:00Added an answer on May 14, 2026 at 8:43 pm

    The problem may be in the os.path.isfile("gui/%s.py" % lang) line. You are using a relative path here. Use an absolute path instead and you should be fine.

    Some other pieces of advice:

    1. Don’t use exec to import files. Use __import__ instead
    2. Don’t look for files to decide over a configuration! it’s slow and unreliable. Store the data in a database, for example.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.