One might also say a fair amount of ignorance. Christopher Isherwood wrote a book called "Christopher and his Kind" (still available), which contained "the truth" behind his fiction "Goodbye to Berlin" from "The Berlin Stories" best known first in its stage adaptation by John Van Druten (though he worked with Isherwood), as "I am a Camera". Cabaret was a musical from years later, which took further liberties, and finally the movie became best known. It had a lot to do with what Bob Fosse thought would be effective on film.
In thirties Berlin, poverty and unemployment led to a class of young men and boys who were available for hire and became part of a "scene", but sometimes became fond of the usually foreign gentlemen who gave them money and other gifts. In America these young guys were known as "trade"; they could function with men but usually were straight, had girl friends and wives and basically needed the money. That culture led actual "homosexuals" of this class to dress in drag, full on or modified in various degrees.
Berlin was a huge city, very sophisticated and home to Magnus Hirschfeld, one of the first psychologists to study "inversion" as it was known -- he was himself gay. He had a house with meeting rooms and a museum, which was a place of pilgrimage for homosexual and bi- sexual men and some women. Isherwood knew him and his lover well. Though same sex activity was against the law (Hirschfeld fought hard against this), Berlin was a "free city", especially for Englishmen -- in England the police were far more vigilant.
As Isherwood reveals in "Christopher and his Kind", heterosexuals also liked the freedom of Berlin, which was very cheap to live in for foreigners. This is what allowed the female he befriended to live more or less comfortably (as a small family income allowed him to do) and she was able to "put out" without judgment, though the real character was tough and unsentimental and knew the score about "Christopher".
The Nazis loomed through this period but achieved complete power only gradually and of course obliterated this scene.
There were "gay meccas", mostly in the Middle East, but Paris was also an easy and safe if more expensive place to look for gay sex. Italy had been very cheap into the early twenties, and remained reasonably accommodating to gay men in the more rural and very poor South, with Rome as sort of a nexus of activity. Northern Italy though was far less accommodating and the Fascists, though less well organized and brutal than the Nazis, were sometimes effectively intolerant of open homosexuals.
After Berlin, Englishmen with a little money, found Depression and war time New York, very similar, though there was a stronger emphasis on "identification" as homosexual, as opposed to the "anything goes" culture among the poor in Berlin, Tangiers or Southern Italy, which meant that fewer young men were readily available. (Isherwood joined his close friend W. H. Auden in New York for a time, but then journeyed to LA. Auden had been in Berlin but it was the poet Stephen Spender who was there more often with Isherwood.
The "high end" cabaret scene everywhere was a different matter; this was expensive even in Berlin and very expensive in Paris and New York. Of course it had a gay aspect but that didn't really predominate as it did in the lower class bars, clubs and beer halls that were meeting places for poorer "boys" and the only moderately well off men who wanted to meet them.