Docker Hostname Stack Overflow Fix
I generally put something like this in settings.py: import socket try: HOSTNAME = socket.gethostname() except: HOSTNAME = 'localhost' My solution does not work, if you use Docker. It will show the container ID instead of the URL. My solution was written before Docker existed. Sorry.
A Stack Overflow-style screenshot shows Python code that sets HOSTNAME to the machine hostname, with answers explaining that Docker returns the container ID instead of the URL and that the solution predates Docker. The joke is a dry programming excuse for outdated advice, used when an old solution fails because modern technology changed the environment. EN: A Stack Overflow-style screenshot shows Python code that sets HOSTNAME to the machine hostname, with answers explaining that Docker returns the container ID instead of the URL and that the solution predates Docker. The joke is a dry programming excuse for outdated advice, used when an old solution fails because modern technology changed the environment.
Stack Overflow webpage / страница Stack OverflowPython code / код Pythoncode editor text / текст редактора кодаcomputer hostname / имя хоста компьютераDocker container / контейнер DockerURL / URLcontainer ID / идентификатор контейнераgray code block / серый блок кодаgreen check mark / зелёная галочкаupvote and downvote arrows / стрелки голосования
- @profunctor_io / 5722 2020-11-03
- Template
- Stack Overflow screenshot
- Type
- image
- Size
- 727×346 · 26.9 KiB
- Mood
- dry, sarcastic
- Language
- en
- Added