title: Docker-compose access container with service name in python file?
body: <p>I have a two container and How I can access another container in python file with django web server </p>
  
  <h1>Docker-compose.yml file</h1>
  
  <pre><code>version: '2'
  
  services:
  
    web:
      build: ./web/
      command: python3 manage.py runserver 0.0.0.0:8001
      volumes:
        - ./web:/code
      ports:
        - "8001:80"
      networks:
        - dock_net
      container_name: con_web
      depends_on:
        - "api"
      links:
        - api
    api:
      build: ./api/
      command: python3 manage.py runserver 0.0.0.0:8000
      volumes:
        - ./api:/code
      ports:
        - "8000:80"
      networks:
        - dock_net
      container_name: con_api
  
  networks:
    dock_net:
        driver: bridge
  </code></pre>
  
  <h1>Python File:</h1>
  
  <p>I can get mail_string  from form</p>
  
  <pre><code>   mail = request.POST.get('mail_string', '') 
     url = 'http://con_api:8000/api/'+mail+'/?format=json'
     resp = requests.get(url=url)         
     return HttpResponse(resp.text)
  </code></pre>
  
  <p>I request api container and get value but  I dont know ip address</p>