views:

28

answers:

1

Hi folks,

my admin urls are sat behind a prefix by doing the following.

1#

(r'^admin/', include(admin.site.urls)),

is placed within urls_core.py

2#

(r'^api/', include('project.urls_core')),

is palced within urls.py


All admin URLs work fine except app indexes.

If I go to any URL such as:

  • /api/admin/core/
  • /api/admin/registration/
  • /api/admin/users/
  • /api/admin/filters/

I receive 'INVALID REQUEST' as my response. Status code is 200 (OK) though.


I have never received this error message before.

Does anyone have a clue? Thanks guys!

+1  A: 

I think some middleware, that strips the leading api/ from the url should help you:

import re

class URLPrefixMiddleware:
    def process_request(self, request):
        request.path = re.sub('^api/','',request.path)

You shouldn't need your additional URL configuration then anymore. Put it in middleware.py in some app dir and add it to installed middleware!

lazerscience
thanks for that! =D
RadiantHex