I'm putting this right up front where everyone can see it: This post isn't about my political views. This blog is not the place for those and frankly they have very little to do with my writing process anyway. This has to do with the very sticky problem of writing stories where politics might somehow seep into the cracks or, in some cases, flood into the entire story. This can be difficult for some writers to work with, and even more troubling to do in a way that doesn't scare off half your audience. However, it can be done, and sometimes it should be done.
If you are not writing about politics, it's always worth remembering what traits of your character may cause the reader to make certain assumptions that could drag politics into your story whether you like it or not. If you demonstrate that your character is pro-life, anti-gun, supports limited government or wants a better healthcare system, you risk dragging a pile of baggage into the game. This might work out fine for your story; the important part is to remember where the reader may travel despite your direction. If, say, the character is not right-leaning but makes a pro-life statement, consider whether you can guide the reader back to the story with some simple narrative cues. If the character says, "I'm not trying to get all political, I just feel this particular way about this subject," then it can isolate the situation and not let it influence the reader's assumptions about the character.
Of course, another way to address this is to steer around delicate subjects entirely if they are not crucial to the plot. Maybe you've noticed this in TV shows, but often when things like salaries, house prices, or large sums of money are discussed among middle-class characters, the actual number is never stated. This prevents different demographics from developing different opinions about the situation, and instead the audience responds to the character's reaction rather than the number itself. The same can be done with a character's political positions - casually stepping around them. If your character is a middle manager at a big bank, does their opinion on climate change or the gender discussion even matter to the story? These points can be discussed without the character landing in a particular camp, and often this is done intentionally so the author doesn't lose a big swathe of their audience. It becomes an unknown that people discuss in book clubs, but never something that is driven home in the text.
The most important part of writing and politics, however, is never let controversy stop you from writing about something. Ultimately, if political views are going to be a part of your story, write about them with the same passion you would give to any other thing you felt strongly about. If you want to frame it in a way that draws the most readers, then fine. If you feel the need to remind people that you as a writer are different than your characters, go ahead. Whatever makes you feel comfortable. Just don't let the noise of the political debate stop you from writing something you feel strongly about. You're a writer. Your job is to write. So set aside the noise of the mob and write it.