quokkaproject / quokka

LOOKING FOR NEW MAINTAINER - Quokka is a Content Management System - `docker run --rm -it -p 5000:5000 quokka/quokka`
http://www.quokkaproject.org
Other
2.23k stars 448 forks source link

No handlers could be found for logger "root" #340

Closed erichideki closed 8 years ago

erichideki commented 8 years ago

I'm running the Quokka CMS throught Docker containers, like instructed https://github.com/quokkaproject/docker-gunicorn-supervisor

When I run:

docker-compose run --rm quokka python manage.py populate

This problem occurrs in manage.py (https://github.com/rochacbruno/quokka/blob/9a30d629a6e4877f952342eac7472e0bc91efa92/manage.py)

☁  docker-gunicorn-supervisor [master] docker-compose run --rm quokka python manage.py populate
Starting dockergunicornsupervisor_mongo_1
No handlers could be found for logger "root"
Traceback (most recent call last):
  File "manage.py", line 9, in <module>
    app = create_app()
  File "/quokka/quokka/__init__.py", line 24, in create_app
    configure_extensions(app, admin_instance or admin)
  File "/quokka/quokka/ext/__init__.py", line 18, in configure_extensions
    db.init_app(app)
  File "/usr/lib/python2.7/site-packages/flask_mongoengine/__init__.py", line 134, in init_app
    connection = _create_connection(settings)
  File "/usr/lib/python2.7/site-packages/flask_mongoengine/__init__.py", line 89, in _create_connection
    return mongoengine.connect(conn.pop('db', 'test'), **conn)
  File "/usr/lib/python2.7/site-packages/mongoengine/connection.py", line 173, in connect
    return get_connection(alias)
  File "/usr/lib/python2.7/site-packages/mongoengine/connection.py", line 135, in get_connection
    raise ConnectionError("Cannot connect to database %s :\n%s" % (alias, e))
mongoengine.connection.ConnectionError: Cannot connect to database default :
[Errno 111] Connection refused

Your operating system name and version.

rochacbruno commented 8 years ago

@erichideki do you have a running MOngoDB container? how did you started MOngo?

erichideki commented 8 years ago

Yes. If I do docker ps:

cbd66d28c6d6 dockergunicornsupervisor_quokka "supervisord -c /etc/" About an hour ago Up 2 minutes 0.0.0.0:5000->5000/tcp dockergunicornsupervisor_quokka_1

8a68f6cfa147 mongo "/entrypoint.sh mongo" About an hour ago Up About an hour 0.0.0.0:32770->27017/tcp dockergunicornsupervisor_mongo_1

My MongoDB is running? Right?

I don't know what black magic is going on, but, the populate content besides the error message, the content was posted, as you can see in the image attached.

quokka-cms-populated

erichideki commented 8 years ago

So, if this content is the right, ignore this issue because I don't know what happened :confused:

vmesel commented 8 years ago

Hey Bruno and Eric, I just got into a similar problem: My Localhost Quokka is populating with the content, but the CLI output of the running application is:

current_app is inaccessible: working outside of application context Error reading all settings from db: 'module' object has no attribute 'config' current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context current_app is inaccessible: working outside of application context

Maybe it's a bug, but I can't find any "current_app()" running on the code!

rochacbruno commented 8 years ago

Fixed.

Instead of docker-compose run --rm quokka python manage.py populate you have to run docker-compose exec quokka python manage.py populate

run instantiate a new container while exec executes the command in the running instance (which is connected to mongo)

erichideki commented 8 years ago

But, docker-compose does not have exec command, just docker.

☁ docker-gunicorn-supervisor [master] docker --help

Commands: attach Attach to a running container build Build an image from a Dockerfile commit Create a new image from a container's changes cp Copy files/folders between a container and the local filesystem create Create a new container diff Inspect changes on a container's filesystem events Get real time events from the server exec Run a command in a running container export Export a container's filesystem as a tar archive history Show the history of an image images List images import Import the contents from a tarball to create a filesystem image info Display system-wide information inspect Return low-level information on a container or image kill Kill a running container load Load an image from a tar archive or STDIN login Register or log in to a Docker registry logout Log out from a Docker registry logs Fetch the logs of a container network Manage Docker networks pause Pause all processes within a container port List port mappings or a specific mapping for the CONTAINER ps List containers pull Pull an image or a repository from a registry push Push an image or a repository to a registry rename Rename a container restart Restart a container rm Remove one or more containers rmi Remove one or more images run Run a command in a new container save Save an image(s) to a tar archive search Search the Docker Hub for images start Start one or more stopped containers stats Display a live stream of container(s) resource usage statistics stop Stop a running container tag Tag an image into a repository top Display the running processes of a container unpause Unpause all processes within a container update Update resources of one or more containers version Show the Docker version information volume Manage Docker volumes wait Block until a container stops, then print its exit code

☁ docker-gunicorn-supervisor [master] docker-compose --help

Commands: build Build or rebuild services config Validate and view the compose file create Create services down Stop and remove containers, networks, images, and volumes events Receive real time events from containers help Get help on a command kill Kill containers logs View output from containers pause Pause services port Print the public port for a port binding ps List containers pull Pulls service images restart Restart services rm Remove stopped containers run Run a one-off command scale Set number of containers for a service start Start services stop Stop services unpause Unpause services up Create and start containers version Show the Docker-Compose version information

rochacbruno commented 8 years ago

humm

[root@docker-gunicorn-supervisor]# docker-compose --version
docker-compose version 1.7.0rc1, build 1ad8866

That is my version and look the exec command there

[root@docker-gunicorn-supervisor]# docker-compose
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f=<arg>...] [options] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  -f, --file FILE             Specify an alternate compose file (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name (default: directory name)
  --verbose                   Show more output
  -v, --version               Print version and exit
  -H, --host HOST             Daemon socket to connect to

  --tls                       Use TLS; implied by --tlsverify
  --tlscacert CA_PATH         Trust certs signed only by this CA
  --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
  --tlskey TLS_KEY_PATH       Path to TLS key file
  --tlsverify                 Use TLS and verify the remote
  --skip-hostname-check       Don't check the daemon's hostname against the name specified
                              in the client certificate (for example if your docker host
                              is an IP address)

Commands:
  build              Build or rebuild services
  config             Validate and view the compose file
  create             Create services
  down               Stop and remove containers, networks, images, and volumes
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pulls service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  start              Start services
  stop               Stop services
  unpause            Unpause services
  up                 Create and start containers
  version            Show the Docker-Compose version information
rochacbruno commented 8 years ago

@erichideki docker-compose --version which version are you running?

erichideki commented 8 years ago

Bingo!!!

My docker-compose is docker-compose version 1.6.2. But, I have a discount that Docker-Compose 1.7.0 was released today (https://github.com/docker/compose/releases).

And the exec feature was added now.

Added the docker-compose exec command for executing a process in a running
container.
erichideki commented 8 years ago

So, warning in the message saying that docker-compose exec it's only available for docker-compose 1.7.0 :+1:

rochacbruno commented 8 years ago

:)

ZahoorAhmad commented 5 years ago

same error running on ubuntu 18.04