Changing Django settings variable dynamically based on request for multiple site

前端 未结 1 711
慢半拍i
慢半拍i 2020-12-20 06:52

Please advice whether is it correct method to change the urlconf and templatedir variables of a django settings file dynamically within a custom middleware function based on

相关标签:
1条回答
  • 2020-12-20 07:33

    No. I don't know why you would want to do this. If you have multiple sites, the correct way to serve them is with multiple WSGI instances, each pointing at separate settings.py and urls.py files.

    Edit after comment: This has nothing to do with the sites framework, which is completely optional. As I say, if you want to serve multiple sites, use multiple .wsgi scripts each pointing to a separate urls.py and settings.py. All the rest of the code can be the same.

    0 讨论(0)
提交回复
热议问题