Reversing namespaced URLs in Django: multiple instances of the same app

前端 未结 5 1837
鱼传尺愫
鱼传尺愫 2020-12-30 07:09

I\'ve been working with Django for a while now (currently on version 1.2), but just recently started working on an app that needs to support multiple instances. E.g., the p

5条回答
  •  猫巷女王i
    2020-12-30 07:24

    There is a doc page about reversing namespaced urls.

    http://docs.djangoproject.com/en/dev/topics/http/urls/#topics-http-reversing-url-namespaces

    Either reverse('instance1:myapp.urls.some_view') or reverse('instance1:view_name') should work, or both :) - i've never tried this myself.

提交回复
热议问题