#30647: [FATAL] FileNotFoundError with runserver command inside Docker container
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  steinbachr                         |
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  2.2
  Uncategorized                      |       Keywords:  docker docker-
               Severity:  Normal     |  compose autoreload
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 **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"]
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30647>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.b741414ccabe8cf7f5d595f4dd212586%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to