Hi,

I've been banging my head against this problem for a few days now, and
haven't been able to find any solution. I have a Django app deployed
to apache at a sub url mounting point ('/myproject') and I have no
problem access the app. However, when I use {% get_static_prefix %} in
my template to reference javascript file, the path that Django spits
out is "/static/js/myscript.js". What I'm expecting is "/myproject/
static/js/myscript.js", i.e. Django takes the WSGIAlias into account.

Note that this problem is not restricted to static file. Any Django
function that utilises reverse() (e.g. redirect()) also error out with
NoReverseMatch exception for the same reason.

Have I missed a glaring config error? All the documentations (Django,
mod_wsgi, etc.) say this configuration should "just work". But instead
I found it never work.

TIA,
Alex

=========

Apache conf
------------------

WSGIScriptAlias /directory "/Library/WebServer/Documents/apache/
django.wsgi"

LogLevel info
ErrorLog  /Library/WebServer/Documents/apache/error.log

<Directory "/Library/WebServer/Documents/apache">
        Order allow,deny
        Allow from all
</Directory>

wsgi script
----------------

import os
import site
import sys

sys.stdout = sys.stderr

# Remember original sys.path.
prev_sys_path = list(sys.path)

site_dir = '/Library/WebServer/Documents/apache/virtual_env/lib/
python2.7/site-packages'
site.addsitedir(site_dir)

apache_configuration = os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(project)
sys.path.append(workspace)
sys.path.append('/Library/WebServer/Documents/')
sys.path.append('/Library/WebServer/Documents/myproject')

# Reorder sys.path so new directories at the front.
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

os.environ['PYTHON_EGG_CACHE'] = '/Library/WebServer/Documents/apache/
python-eggs'
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to