Tuesday, 9 February 2021

Is modifying Django urlconf via set_urlconf and request.urlconf in a middleware safe?

I am changing the default urlconf in a middleware based on the requested hostname and it's working as expected during development, however I am concerned about racing/threads as I am modifying a Django setting at runtime!

My concern is that Django would confuse the urlconfs with many concurrent requests. Is that a valid concern?



from Is modifying Django urlconf via set_urlconf and request.urlconf in a middleware safe?

No comments:

Post a Comment