2
Iโm pretty sure the ad code IS only running once, on process startup. The models are not reloaded for every page request, but are initialized one time,
If you put your ad logic in get_context_data
it should load a random ad on each request, as get_context_data
is called per request
from a similar question i asked:
Class attributes are shared across all instances of the class within a
process, and since a process lasts across many requests, the data will
persist across those requests.
Source:stackexchange.com