I have my Django website and my static files deployed under the same
directory (i.e. no separate 'static' directory), according to the
following Apache RewriteRule:
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^.*$ /django/$1 [QSA,PT,L]
WSGIScriptAlias /django/ /var/www/domain.com/django/site/wsgi.py
My site-wide urlconf looks like this:
urlpatterns = patterns('',
url(r'^blog/', include('blog.urls')),
url(r'', include('home.urls')),
)
With my app-specific urlconf ('home.urls') is simply this:
urlpatterns = patterns('home.views',
url(r'^(?P<uri>[a-z0-9-]+)/?$', 'page_by_uri'),
url(r'^$', 'index'),
)
So when I visit my site domain.com I should see the index view (which it
does), and when I visit domain.com/foo I should see the
page_by_uri('foo') view, *which it doesn't*. Instead, it shows the index
view. (And I thought it should give an error!)
Having surfed around a little bit, I reckon it's got something to do
with Django's handling of SCRIPT_NAME (which should be equal to the
mount point, in my case '/dj'). Various solutions are proposed,
generally involving adding the mount point to my urlconf (bad!) until I
tried it and it doesn't even work...
Basically, how in the name of all that is holy and sacred can I get this
to work?!
Thanks in advance
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment