question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Local Docker: python: can't open file 'manage.py': [Errno 2] No such file or directory

See original GitHub issue

What happened?

I get this error message python: can't open file 'manage.py': [Errno 2] No such file or directory after running the following commands:

docker-compose -f local.yml build
docker-compose -f local.yml up -d

What should’ve happened instead?

Django should have been running on my local docker-machine

Steps to reproduce


# cookiecutter https://github.com/pydanny/cookiecutter-django
You've downloaded C:\Users\ph\.cookiecutters\cookiecutter-django before. Is it okay to delete and re-download it? [yes]: yes
project_name [My Awesome Project]: mytestproject.nu
project_slug [mytestproject_nu]:
description [Behold My Awesome Project!]: My Test Project
author_name [Daniel Roy Greenfeld]: Philip
domain_name [example.com]: mytestproject.nu
email [philip-hoyos@example.com]: ph@mytestproject.nu
version [0.1.0]:
Select open_source_license:
Choose from 1, 2, 3, 4, 5 [1]: 1
timezone [UTC]: Europe/Copenhagen
windows [n]: y
use_pycharm [n]: y
use_docker [n]: y
Select postgresql_version:
Choose from 1, 2, 3, 4, 5, 6, 7, 8 [1]: 1
Select js_task_runner:
Choose from 1, 2 [1]: 1
Select cloud_provider:
Choose from 1, 2 [1]: 2
custom_bootstrap_compilation [n]: n
use_compressor [n]: y
use_celery [n]: y
use_mailhog [n]: y
use_sentry [n]: y
use_whitenoise [n]: n
use_heroku [n]: n
use_travisci [n]: n
keep_local_envs_in_vcs [y]: y
debug [n]: n
 [SUCCESS]: Project initialized, keep up the good work!

docker-compose -f local.yml build docker-compose -f local.yml up -d

# docker-machine --version
Docker-machine version 0.16.1, build cce350d7

# docker --version
Docker version 18.09.2, build 6247962

Microsoft Windows 10 Pro Version 10.0.17134 Build 17134

# docker-compose -f local.yml logs
 Attaching to mytestproject_nu_celeryworker_1, mytestproject_nu_django_1, mytestproject_nu_flower_1, mytestproject_nu_celerybeat_1, mytestproject_nu_postgres_1, mytestproject_nu_mailhog_1, mytestproject_nu_redis_1
celeryworker_1  | Waiting for PostgreSQL to become available...
celeryworker_1  | Waiting for PostgreSQL to become available...
celeryworker_1  | PostgreSQL is available
celeryworker_1  | Error:
celeryworker_1  | Unable to load celery application.
celeryworker_1  | The module config was not found.
celeryworker_1  |
django_1        | Waiting for PostgreSQL to become available...
postgres_1      | The files belonging to this database system will be owned by user "postgres".
postgres_1      | This user must also own the server process.
postgres_1      |
django_1        | Waiting for PostgreSQL to become available...
postgres_1      | The database cluster will be initialized with locale "en_US.utf8".
django_1        | PostgreSQL is available
postgres_1      | The default database encoding has accordingly been set to "UTF8".
postgres_1      | The default text search configuration will be set to "english".
postgres_1      |
postgres_1      | Data page checksums are disabled.
postgres_1      |
postgres_1      | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1      | creating subdirectories ... ok
postgres_1      | selecting default max_connections ... 100
postgres_1      | selecting default shared_buffers ... 128MB
postgres_1      | selecting dynamic shared memory implementation ... posix
postgres_1      | creating configuration files ... ok
postgres_1      | running bootstrap script ... ok
postgres_1      | performing post-bootstrap initialization ... ok
postgres_1      | syncing data to disk ... ok
postgres_1      |
postgres_1      | WARNING: enabling "trust" authentication for local connections
django_1        | python: can't open file 'manage.py': [Errno 2] No such file or directory
postgres_1      | You can change this by editing pg_hba.conf or using the option -A, or
postgres_1      | --auth-local and --auth-host, the next time you run initdb.
postgres_1      |
postgres_1      | Success. You can now start the database server using:
postgres_1      |
postgres_1      |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1      |
postgres_1      | waiting for server to start....2019-05-19 09:32:59.577 UTC [40] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1      | 2019-05-19 09:32:59.596 UTC [41] LOG:  database system was shut down at 2019-05-19 09:32:59 UTC
postgres_1      | 2019-05-19 09:32:59.601 UTC [40] LOG:  database system is ready to accept connections
mailhog_1       | 2019/05/19 09:32:57 Using in-memory storage
postgres_1      |  done
postgres_1      | server started
mailhog_1       | 2019/05/19 09:32:57 [SMTP] Binding to address: 0.0.0.0:1025
mailhog_1       | [HTTP] Binding to address: 0.0.0.0:8025
mailhog_1       | 2019/05/19 09:32:57 Serving under http://0.0.0.0:8025/
postgres_1      | CREATE DATABASE
mailhog_1       | Creating API v1 with WebPath:
postgres_1      |
mailhog_1       | Creating API v2 with WebPath:
postgres_1      |
postgres_1      | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres_1      |
postgres_1      | 2019-05-19 09:33:00.080 UTC [40] LOG:  received fast shutdown request
postgres_1      | waiting for server to shut down....2019-05-19 09:33:00.087 UTC [40] LOG:  aborting any active transactions
postgres_1      | 2019-05-19 09:33:00.090 UTC [40] LOG:  worker process: logical replication launcher (PID 47) exited with exit code 1
postgres_1      | 2019-05-19 09:33:00.090 UTC [42] LOG:  shutting down
postgres_1      | 2019-05-19 09:33:00.110 UTC [40] LOG:  database system is shut down
postgres_1      |  done
postgres_1      | server stopped
postgres_1      |
postgres_1      | PostgreSQL init process complete; ready for start up.
postgres_1      |
postgres_1      | 2019-05-19 09:33:00.191 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
redis_1         | 1:C 19 May 09:32:57.284 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
postgres_1      | 2019-05-19 09:33:00.191 UTC [1] LOG:  listening on IPv6 address "::", port 5432
redis_1         |                 _._
postgres_1      | 2019-05-19 09:33:00.197 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1      | 2019-05-19 09:33:00.212 UTC [58] LOG:  database system was shut down at 2019-05-19 09:33:00 UTC
postgres_1      | 2019-05-19 09:33:00.217 UTC [1] LOG:  database system is ready to accept connections
redis_1         |            _.-``__ ''-._
redis_1         |       _.-``    `.  `_.  ''-._           Redis 3.2.12 (00000000/0) 64 bit
redis_1         |   .-`` .-```.  ```\/    _.,_ ''-._
redis_1         |  (    '      ,       .-`  | `,    )     Running in standalone mode
redis_1         |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
redis_1         |  |    `-._   `._    /     _.-'    |     PID: 1
redis_1         |   `-._    `-._  `-./  _.-'    _.-'
redis_1         |  |`-._`-._    `-.__.-'    _.-'_.-'|
redis_1         |  |    `-._`-._        _.-'_.-'    |           http://redis.io
redis_1         |   `-._    `-._`-.__.-'_.-'    _.-'
redis_1         |  |`-._`-._    `-.__.-'    _.-'_.-'|
redis_1         |  |    `-._`-._        _.-'_.-'    |
redis_1         |   `-._    `-._`-.__.-'_.-'    _.-'
redis_1         |       `-._    `-.__.-'    _.-'
redis_1         |           `-._        _.-'
redis_1         |               `-.__.-'
redis_1         |
redis_1         | 1:M 19 May 09:32:57.288 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1         | 1:M 19 May 09:32:57.288 # Server started, Redis version 3.2.12
celerybeat_1    | Waiting for PostgreSQL to become available...
celerybeat_1    | Waiting for PostgreSQL to become available...
redis_1         | 1:M 19 May 09:32:57.288 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1         | 1:M 19 May 09:32:57.288 * The server is now ready to accept connections on port 6379
celerybeat_1    | PostgreSQL is available
celerybeat_1    | Error:
celerybeat_1    | Unable to load celery application.
celerybeat_1    | The module config was not found.
celerybeat_1    |
flower_1        | Waiting for PostgreSQL to become available...
flower_1        | Waiting for PostgreSQL to become available...
flower_1        | PostgreSQL is available
flower_1        | Error:
flower_1        | Unable to load celery application.
flower_1        | The module config was not found.
flower_1        |

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:43 (13 by maintainers)

github_iconTop GitHub Comments

7reactions
mahidul-islamcommented, Oct 5, 2019

Having same issue on ubuntu

5reactions
James7777commented, Oct 27, 2019

I was getting the same issue, it seem to have been the mounting issue. how I resolved it;

  • I think there is an issue with access to folders outside “C:\Users” area in windows - make sure your app is located in “C:\Users\your PC_NAME\your folder\your app”. this was my main issue. you can also add 'any other folder location ’ to virtualbox After this, I deleted all containers and images, deleted cache, rebuilt the app. steps 1- moved my app to “C:\Users\your PC_NAME\your folder\your app” 2- docker stop $(docker ps -a -q) 3- docker-compose -f local.yml down --rmi all -v 4- docker builder prune 5- docker system prune -a 6- docker-compose -f local.yml build 7- docker-compose -f local.yml up Hope this helps someone with the same issue.
Read more comments on GitHub >

github_iconTop Results From Across the Web

When run docker-compose up I get python: can't open file ...
When run docker-compose up I get python: can't open file 'manage.py': [Errno 2] No such file or directory · Have you tried following...
Read more >
Local Docker: python: can't open file 'manage.py': [Errno 2] No ...
I get this error message python: can't open file 'manage.py': [Errno 2] No such file or directory after running the following commands: ...
Read more >
can't open file manage.py [errno 2] No such file or directory
From your Dockerfile, the contents of the local folder are being copied into the image into the folder /usr/src/app. I assume this is...
Read more >
Can't open file 'manage.py': [Errno 2] No such file or directory ...
A2A · That error is most likely related to your program, not the IDE. · One easy fix is to copy the file...
Read more >
can't open file 'manage.py': [Errno 2] No such file or directory
can't open file ' manage. py ': [ Errno 2 ] No such file or directory found error in Django python frameworkSubscribe the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found