cookiecutter-django: Local Docker: python: can't open file 'manage.py': [Errno 2] No such file or directory
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 |
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 43 (13 by maintainers)
Having same issue on ubuntu
I was getting the same issue, it seem to have been the mounting issue. how I resolved it;
Just wanted to update - having this same issue on a Mac…2021. This isn’t a Windows issue.
I had the same problem a while ago and in my case was related to Docker for Windows. Try reset docker to factory defaults and share the drive where your project is located.
That’s because the Postgres DB is reusing the volume you created earlier (in project 1). Now your new project 2 has different credentials.
Should remove all the volumes and images. If you rebuild that should work 🤞
How did you fix it?
I have this issue on Ubuntu 20. So not Windows or Mac specific either.
As I recall the issue was due to mounting issues with the docker installation on windows. It seemed to me that it had nothing to do with cookiecutter itself but was related to the docker configuration on windows. That was the reason that I closed it. @James7777 seems to have found the solution to that problem - that specific note could be useful to have in the documentation.
The issue is closed because it’s not something we can fix in this project, it’s a more general docker-compose issue with Windows.
I don’t have a Windows machine, so it’s hard for me to pin down the exact conditions causing this problem. However, if someone who understands the problem wants to add a paragraph to the troubleshooting section with an actionable solution, I don’t mind adding it.
Has anyone tried my earlier suggestion? Adding the code to your local container like we do in the production one:
https://github.com/pydanny/cookiecutter-django/blob/729dddcab6afacdce49f5ce200af1c1b97ebbbea/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile#L62
I made the change on a branch, you can try it:
cookiecutter https://github.com/pydanny/cookiecutter-django --checkout fix/empty-local-docker
Ok, so it’s NOT related to Celery, there is still this same error…
Thanks for your patience and help in providing all of these. I don’t know why you have this though 😞