Indeed, after years of neglect and bitter battles over its gentrification, the Tenderloin remains one of the most stubborn challenges in San Francisco, a city that prides itself on its looks, its way of life and its bold solutions to social ills, whether they involve offering universal health care (the city was the first to do so) or banning plastic bags (ditto).

Image Civic boosters are hoping to turn the grit of the Uptown Tenderloin district into an attraction, pointing out its ties to music (the Grateful Dead recorded there) and its “rich vice history” (alas, the gambling dens and speakeasies are gone). Credit... Thor Swift for The New York Times

So it is that armed with a recent listing on the National Register of Historic Places, community and city leaders are readying the Tenderloin for its big moment, complete with plans for a new museum, an arts district and walking tours of “the world’s largest collection of historic single-room occupancy hotels.” And unlike, say, the Tenement Museum in New York, which offers tours of a long-unused Lower East Side apartment building, a trip to the Tenderloin could go a step further.

“We can bring people into an SRO and show them where people are living now,” Mr. Shaw said, referring to the single-room occupancy dwellings, or residential hotels, in the area. “And that’s a real plus.”

Mr. Shaw’s plan has the backing of Mayor Gavin Newsom, who announced a city grant last month to help promote “a positive identity for the Tenderloin” and to draw tourism to the area, in part by posting hundreds of plaques on buildings throughout the neighborhood “to create great visual interest for those walking down the community’s streets.”

And oh, what streets those are. Wedged between tourist-friendly Union Square and its liberal-friendly City Hall, the Tenderloin is one of the mostly densely populated areas west of the Mississippi, officials say, with some 30,000 people in 60 square blocks, almost all of which have at least one residential hotel. The district’s drug trade is so widespread, and so wide open, that the police recently asked for special powers to disperse crowds on certain streets. Deranged residents are a constant presence, and after dark the neighborhood can seem downright sinister, with drunken people collapsed on streets and others furtively smoking pipes in doorways.