localhost is always 127.0.0.1, you are not supposed to change that. What you need is to create a static address to your development machine so that your server always have access to it even if your IP changes. There are a few ways of doing that.
You can use a "Free dynamic DNS service" provider (such as dynu.net) to create a DNS name that is always updated with your IP address, your server can access that DNS whenever it needs to reach your development machine. Easy to use, not recommended though for numerous reasons (DNS may take a while to update if your IP changes, your local setup will also be accessible directly from any peer in the Internet, maybe your IP gets cached and takes even longer -- or never -- to update so the solution might not even work at all).
Personally I'd use a VPN. You can setup a VPN between your dev machine and the server, so that you are always accessible with the same IP within the VPN. If your remote IP changes, it doesn't matter because your VPN IP is static. If you have to use a backup connection that doesn't even support port forwarding such as your neighbor's Wi-Fi, it doesn't matter either, with a VPN tunnel everything just works as long as you have a working Internet access.
Personally I use OpenVPN, recently I heard tinc is better and easier to use but I'm not familiar with this alternative.