# Django set a connection proxy

**URL:** <https://forum.djangoproject.com/t/django-set-a-connection-proxy/13903>\
**Category:** Deployment\
**Created:** [May 24, 2022, 2:24pm UTC](https://forum.djangoproject.com/t/django-set-a-connection-proxy/13903 "2022-05-24T14:24:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smailt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/smailt/32/8270_2.png) [@smailt](https://forum.djangoproject.com/u/smailt)\
**Post date:** [May 24, 2022, 2:24pm UTC](https://forum.djangoproject.com/t/django-set-a-connection-proxy/13903/1 "2022-05-24T14:24:28Z")

</div>

0

I have long time seeking for a solution to set a proxy for my Django application.

1st I am using Django==2.0 and I run it in Windows Server 2016 in a local network that uses a Proxy to connect 10.37.235.99 and Port 80. and I’m deploying the application using nginx-1.20.1

I have to scrape a data as

```auto
    http_proxy = "10.37.235.99:80"
    https_proxy = "10.37.235.99:80"
    ftp_proxy = "10.37.235.99:80"

    proxyDict = { 
                  "http" : http_proxy, 
                  "https" : https_proxy, 
                  "ftp" : ftp_proxy
                }
    import socket
    if socket.gethostname() == "localhost":
        os.environ["PROXIES"] = proxyDict
    else:
        os.environ["PROXIES"] = {}
    URL='my_site.com'
    page = requests.get(URL)
    print(page)

```

I tried many solutions on the internet but no way! [Working with django : Proxy setup](https://stackoverflow.com/questions/14284824/working-with-django-proxy-setup)

when I remove the proxy configuration and I use Psiphon3(with proxy) everything works perfectly.

is there any solution?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 24, 2022, 2:40pm UTC](https://forum.djangoproject.com/t/django-set-a-connection-proxy/13903/2 "2022-05-24T14:40:21Z")

</div>

It looks like you’re talking about a situation where you need to make an outbound connection through a proxy, not set up a proxy connection to allow for inbound requests, is that correct?

If so, then this isn’t a Django issue. No configuration changes to Django should be needed. It does not look like you’re using Django to retrieve data from that external site.

Your Python code to make that external request should work _exactly_ the same way regardless of whether its running in Django or not.

Having said that, most Windows proxies can create _real_ problems, because many of them require the outbound request to be ActiveDirectory authenticated.
