Django trouble
-
So, a while ago I wrote here about starting to experiment with Django, and now I have come to a stop... I usually map my Django projects on the root, but this time I tried something different and failed very badly... I tried to map it to http://foo.com/django and encountered two problems, I hope you guys can help me with... Problem 1: If I go to address http://foo.com/django (without trailing slash) I get an Internal Server Error. Log shows this info:
File "/var/lib/python-support/python2.5/django/middleware/common.py", line 41, in process_request
if settings.APPEND_SLASH and (old_url1-1 != '/') and ('.' not in old_url1.split('/')-1):
IndexError: string index out of rangeIf I include the trailing slash it works (at least it seems to). APPEND_SLASH is (obviously) set to True. Problem 2: Let's go with urls.py that looks like this:
from django.conf.urls.defaults import *
from djangobook.views import hellourlpatterns = patterns('',
(r'^hello/$', hello),
)Instead of going to http://foo.com/django/hello I get redirected to http://foo.com/hello. I presume I'm missing a setting or something to make it relative to the project's starting URL?
We are using Linux daily to UP our productivity - so UP yours!
-
So, a while ago I wrote here about starting to experiment with Django, and now I have come to a stop... I usually map my Django projects on the root, but this time I tried something different and failed very badly... I tried to map it to http://foo.com/django and encountered two problems, I hope you guys can help me with... Problem 1: If I go to address http://foo.com/django (without trailing slash) I get an Internal Server Error. Log shows this info:
File "/var/lib/python-support/python2.5/django/middleware/common.py", line 41, in process_request
if settings.APPEND_SLASH and (old_url1-1 != '/') and ('.' not in old_url1.split('/')-1):
IndexError: string index out of rangeIf I include the trailing slash it works (at least it seems to). APPEND_SLASH is (obviously) set to True. Problem 2: Let's go with urls.py that looks like this:
from django.conf.urls.defaults import *
from djangobook.views import hellourlpatterns = patterns('',
(r'^hello/$', hello),
)Instead of going to http://foo.com/django/hello I get redirected to http://foo.com/hello. I presume I'm missing a setting or something to make it relative to the project's starting URL?
We are using Linux daily to UP our productivity - so UP yours!
When you deploy on a subdirectory you will need to make sure you account for that in your url patterns. Take a look here.[^]
And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell
-
When you deploy on a subdirectory you will need to make sure you account for that in your url patterns. Take a look here.[^]
And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell
So, all the url patterns have to start with '/django/ ' ? Besides, there are no instructions for mod_wsgi, or I can't see them?
We are using Linux daily to UP our productivity - so UP yours!
-
So, all the url patterns have to start with '/django/ ' ? Besides, there are no instructions for mod_wsgi, or I can't see them?
We are using Linux daily to UP our productivity - so UP yours!
You shouldn't need to make any mod_wsgi changes. And don't copy the apache config on the link, it looks like it would kill you app :) since it seems to be a mod_python set-up. So, try to leave you apache config alone and start with your patterns.
And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell
-
You shouldn't need to make any mod_wsgi changes. And don't copy the apache config on the link, it looks like it would kill you app :) since it seems to be a mod_python set-up. So, try to leave you apache config alone and start with your patterns.
And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell
Ok, so what I just figured is that I get redirected from foo.com/django/hello to coo.com/hello only if I leave the trailing slash. How can I make django append the trailing slash in the URL? APPEND_SLASH is set to true.
We are using Linux daily to UP our productivity - so UP yours!