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

  • SEARCH
  • Home
  • 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 8168315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:28:57+00:00 2026-06-06T20:28:57+00:00

I’m setting up a django server (1.4, python 2.7) with apache2 + mod_wsgi on

  • 0

I’m setting up a django server (1.4, python 2.7) with apache2 + mod_wsgi on a Debian system. From the django side, everything works perfect, if I run manage.py runserver, the development server displays the site correctly, however, when I try to set up my apache server to run WSGI, it fails displaying a ValueError.

This is mysite.wsgi

ALLDIRS = ['/usr/local/lib/python2.7/site-packages']
# the above directory depends on the location of your python installation.
# if using virtualenv, it will need to match your projects locale.
import os
import sys
import site

os.environ['DJANGO_SETTINGS_MODULE'] = 'ggDatabase.settings'
prev_sys_path = list(sys.path)
sys.path.append("/usr/local/lib/python2.7")
path = "/home/acad/statsdb/src"
if path not in sys.path:
        sys.path.append(path)
        sys.path.append("/home/acad/statsdb/src/ggDatabase")
for directory in ALLDIRS:
        site.addsitedir(directory)
        new_sys_path = []
        for item in list(sys.path):
            if item not in prev_sys_path:
                new_sys_path.append(item)
                sys.path.remove(item)
                sys.path[:0] = new_sys_path

# change this depending on your project.

site.addsitedir("/home/acad/statsdb/src/ggDatabase/")


os.environ['PYTHON_EGG_CACHE'] = '/home/acad/.python-eggs'
os.environ['SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

This is the apache VirtualHost config:

<VirtualHost 127.0.0.1:8000>
    ServerName mysite.com
    ServerAlias www.mysite.com
    <Directory /home/acad/statsdb/src/ggDatabase>
        Order deny,allow
        Allow from all
    </Directory>

    LogLevel warn
    CustomLog /var/log/apache2/mysite.com.access.log combined
    ErrorLog /var/log/apache2/mysite.com.error.log

    WSGIDaemonProcess mysite.com user=acad group=acad threads=25 python-path=/usr/local/lib/python2.7
    WSGIProcessGroup mysite.com
    WSGIScriptAlias / /home/acad/statsdb/src/ggDatabase/apache/mysite.wsgi

</VirtualHost>

This is the exact configuration I have on my test server and it works there, but the new server runs into a problem when trying to run the wsgi script:

[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1] mod_wsgi (pid=26233): Target WSGI script '/home/acad/statsdb/src/ggDatabase/apache/mysite.wsgi' cannot be loaded as Python module.
[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1] mod_wsgi (pid=26233): Exception occurred processing WSGI script '/home/acad/statsdb/src/ggDatabase/apache/mysite.wsgi'.
[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1] Traceback (most recent call last):
[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1]   File "/home/acad/statsdb/src/ggDatabase/apache/mysite.wsgi", line 31, in <module>
[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1]     import django.core.handlers.wsgi
[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1]   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 8, in <module>
[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1]     from django import http
[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1]   File "/usr/local/lib/python2.7/site-packages/django/http/__init__.py", line 11, in <module>
[Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1]     from urllib import urlencode, quote
 [Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1]   File "/usr/local/lib/python2.7/urllib.py", line 1228, in <module>
 [Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1]     _safe_map[c] = c if (i < 128 and c in always_safe) else '%{:02X}'.format(i)
 [Fri Jun 29 09:38:14 2012] [error] [client 127.0.0.1] ValueError: zero length field name in format

The error is so generic that I really don’t know what could be going wrong. Any ideas?

Thanks in advance!

Bruno

  • 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-06-06T20:28:59+00:00Added an answer on June 6, 2026 at 8:28 pm

    Solved it. If someone has similar errors, make sure to print sys.version, you may find out (as I did) that wsgi was configured under another installed python version.

    If that’s the case, reinstall mod_wsgi with the –with-python option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.