django urls without a trailing slash do not redirect

前端 未结 6 1878
不思量自难忘°
不思量自难忘° 2020-12-02 07:07

I\'ve got two applications located on two separate computers. On computer A, in the urls.py file I have a line like the following:

(r\'^cast/$\         


        
6条回答
  •  借酒劲吻你
    2020-12-02 07:27

    I've had the same problem. In my case it was a stale leftover from some old version in urls.py, from before staticfiles:

    url(r'^%s(?P.*)$' % settings.MEDIA_URL.lstrip('/'),
        'django.views.static.serve',
        kwargs={'document_root': settings.MEDIA_ROOT}),
    

    MEDIA_URL was empty, so this pattern matched everything.

提交回复
热议问题