Sometimes the people just use a 1M resistor in series with the power; personally I'd also add a small zener to reduce risks
simulate this circuit – Schematic created using CircuitLab
However, personally I don't like this. Remember that in this case the ground is tied to the neutral wire, and so the rPI is no more insulated. This is usually a thing I want to avoid with microcontrollers, and much more with a complex system like a rPI which gets attached to a lot of other stuff.
For this reason I highly suggest you to avoid this, and use a proper optocoupler. For instance I have used in the past cheap optocouplers (PC817) to sense the presence of the 230V signal. I suggest you to search for circuits with optocouplers (in my case, I used the optocoupler, a diode to block reverse wave, and 100k resistor(s) to limit the current (in your case you may reduce the value of the resistors). This way high voltage and low voltages are properly separated.
My (slightly different) circuit is in this other question, but there are plenty of them. Note: you will have a 50Hz wave there, so you shall filter it either in SW or in HW