﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30647	[FATAL] FileNotFoundError with runserver command inside Docker container	Bobby Steinbach	Tom Forbes	"**Summary**
Trying to run the development server in a container with volume-mounted source is throwing a FileNotFoundError. I've verified that the issue is consistently reproducible with Django==2.2.3 and not present in Django==2.1.4.

**Trace**

{{{
**INFO** /code/publications/models.py changed, reloading.
**INFO** Watching for file changes with StatReloader
Performing system checks...

Traceback (most recent call last):
  File ""manage.py"", line 21, in <module>
    main()
  File ""manage.py"", line 17, in main
    execute_from_command_line(sys.argv)
  File ""/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py"", line 381, in execute_from_command_line
    utility.execute()
  File ""/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py"", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/usr/local/lib/python3.6/site-packages/django/core/management/base.py"", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File ""/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py"", line 60, in execute
    super().execute(*args, **options)
  File ""/usr/local/lib/python3.6/site-packages/django/core/management/base.py"", line 364, in execute
    output = self.handle(*args, **options)
  File ""/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py"", line 95, in handle
    self.run(**options)
  File ""/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py"", line 102, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File ""/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py"", line 587, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File ""/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py"", line 572, in start_django
    reloader.run(django_main_thread)
  File ""/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py"", line 289, in run
    autoreload_started.send(sender=self)
  File ""/usr/local/lib/python3.6/site-packages/django/dispatch/dispatcher.py"", line 175, in send
    for receiver in self._live_receivers(sender)
  File ""/usr/local/lib/python3.6/site-packages/django/dispatch/dispatcher.py"", line 175, in <listcomp>
    for receiver in self._live_receivers(sender)
  File ""/usr/local/lib/python3.6/site-packages/django/utils/translation/reloader.py"", line 16, in watch_for_translation_changes
    absolute_path = path.absolute()
  File ""/usr/local/lib/python3.6/pathlib.py"", line 1129, in absolute
    obj = self._from_parts([os.getcwd()] + self._parts, init=False)
FileNotFoundError: [Errno 2] No such file or directory
}}}

**Configuration**
''Dockerfile''

{{{
FROM python:3.6.7-alpine3.7

RUN mkdir /code

WORKDIR /code

RUN apk add postgresql-dev libffi-dev build-base musl-dev
RUN apk add linux-headers

ADD requirements.txt .

RUN pip install -r requirements.txt

EXPOSE 3031

ADD cs /code
}}}

''docker-compose''

{{{
version: '3.7'
services:
  db:
    image: postgres
    volumes:
      - ./pg_data:/var/lib/postgresql/data
    ports:
      - ""5432:5432""
    environment:
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
      POSTGRES_DB: postgres

  app:
    build:
      context: .
    volumes:
      - ./cs/:/code/
    ports:
      - ""8000:8000""
    env_file: .env
    command: [""python"", ""manage.py"", ""runserver"", ""0.0.0.0:8000""]
}}}
"	Bug	closed	Core (Other)	2.2	Release blocker	fixed	docker docker-compose autoreload	Tom Forbes	Accepted	1	0	0	0	0	0
