Install Python virtual environment step by step

Using a Python virtual environment (venv) is a great way to manage dependencies for your projects and ensure that each project has its own isolated environment. This prevents conflicts between project requirements and allows you to experiment with different package versions without affecting other projects. Here’s how you can create and use a virtual environment … Read more

How to get client ip address in flask

Flask have 3 methods to retrive client IP 1, request.remote_addr 2, request.environ[‘REMOTE_ADDR’] 3, request.environ[‘HTTP_X_FORWARDED_FOR’] For the first 2 methods request.remote_addr and request.environ[‘REMOTE_ADDR’], we can use it if the server was directly called by clients. But if our sevice behind a proxy, we need to look for the “X-Forwarded-For” header for the client IP. Which means … Read more