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 4070690
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:39:35+00:00 2026-05-20T16:39:35+00:00

Django has been up and running on my mod_wsgi implementation of Apache (on Windows

  • 0

Django has been up and running on my mod_wsgi implementation of Apache (on Windows 7 x64, btw) for a bit. This was a huge pain, complete with having to actually hand-modify registry values to get things to install correctly and to get Django to use the same MySQL install as all my other apps. I also had to modify the PATH variable by double-escaping parentheses (Program Files (x86)) because they were screwing with batch files. But this is mostly Microsoft’s fault and I’m rambling.

Here is my issue:
All of the URLs used in the URLCONF and in views work correctly. The only thing which doesn’t is in templates when I try to work off the site root URL. I am running a development server and I have two Django sites, this particular one running off of http://www.example.com/testing.

In the templates, if I just put “/” in an < a >, then it will point to http://www.example.com/, and NOT http://www.example.com/testing/. I have read a topic on this but the issue wasn’t resolved because the poster was being stubborn. I am posting my WSGI configuration in the httpd.conf below:

Listen 127.0.0.1:8001
 VirtualHost *:8001 >
    ServerName ****.net/testing
    ServerAdmin *******@gmail.com
    ErrorLog ********.log

    WSGIScriptAlias /testing ****/htdocs/testing/apache/django.wsgi

     Directory ****/htdocs/testing/apache >
        Order deny,allow
        Allow from all
     /Directory>
     Location "/media">
        SetHandler None
     /Location>
/VirtualHost>

Note: all “<” omitted so the tags would show

Here is the file django.wsgi in the above directory:

import sys
import os

sys.path.insert(0, '*****/Django/')
sys.path.insert(0, '*****/htdocs/')
sys.path.insert(0, '*****/htdocs/testing')
sys.path.insert(0, '*****/htdocs/testing/apache')

os.environ['DJANGO_SETTINGS_MODULE'] = 'testing.settings'

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

import testing.monitor
testing.monitor.start(interval=1.0)

I have an Nginx frontend which passes any non-static file from testing/ to :8001 for Apache to catch with this virtualhost.

If I omit the root “htdocs/” line from the django.wsgi file, I just get 500 errors on the site. Also, if I use the URL form relative to the current URL (ie “example/” instead of “/example/”), that works alright. But if I add the initial “/” to put the URL off the root, it will make it off of “www.example.com” instead of “www.example.com/testing” like I wanted.

Sorry for the very long post, but I wanted to be as clear as possible. Thank you for your time.

  • 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-20T16:39:36+00:00Added an answer on May 20, 2026 at 4:39 pm

    This is why you should not hard-code URLs in your templates. Of course / will take you to the root of the site, not the root of your app – that’s what it’s supposed to do.

    Instead, give your root view a name in your urlconf:

    urlpatterns = patterns('',
        url('^$', 'myapp.views.index', name='home')
    )
    

    now in your template you can do:

    <a href="{% url home %}">Home</a>
    

    and this will correctly resolve to /testing/.

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

Sidebar

Related Questions

I have done a little Django development, but it has all been in a
I have a App Engine/Python/Django application which has grown and been modified over the
This problem has been bugging me for the last week or so and now
The other person on my dev team has been deploying our Django app to
Maybe this question has been asked a lot, but I still can't understand how
Am building an app using Django as my workhorse. All has been well so
This question has been floating around in one shape or another, but I couldn't
This question has been asked few times here and there, but you see all
You guys have helped me out so much this week it has been awesome.Hopefully
My Django app has a Person table, which contains the following text in a

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.