Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-18 Docker composition for YAMZ #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lewismc
Copy link

@lewismc lewismc commented Sep 12, 2018

Hi @jkunze @nassibnassar this PR is as far as I have got with upgrading the codebase to Python 3.X and to providing the Docker composition.
The glaring issue is that I am unsure as to how to reach the static and template HTML code in html/* from the Flask constructor.

The first step is to build the composition

$ docker-compose build

Then deploy the stack

docker-compose up

...however when deploying locally, I get the following stack trace

Starting yamz_nassibnassar_postgres_1 ... done
Recreating yamz_nassibnassar_yamz_1   ... done
Starting yamz_nassibnassar_pgadmin4_1 ... done
Attaching to yamz_nassibnassar_postgres_1, yamz_nassibnassar_pgadmin4_1, yamz_nassibnassar_yamz_1
postgres_1  | 2018-09-12 01:37:24.828 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres_1  | 2018-09-12 01:37:24.828 UTC [1] LOG:  listening on IPv6 address "::", port 5432
pgadmin4_1  | [2018-09-12 01:37:25 +0000] [1] [INFO] Starting gunicorn 19.8.1
pgadmin4_1  | [2018-09-12 01:37:25 +0000] [1] [INFO] Listening at: http://[::]:80 (1)
pgadmin4_1  | [2018-09-12 01:37:25 +0000] [1] [INFO] Using worker: threads
postgres_1  | 2018-09-12 01:37:24.831 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
pgadmin4_1  | [2018-09-12 01:37:25 +0000] [10] [INFO] Booting worker with pid: 10
postgres_1  | 2018-09-12 01:37:24.844 UTC [24] LOG:  database system was shut down at 2018-09-12 01:37:18 UTC
postgres_1  | 2018-09-12 01:37:24.850 UTC [1] LOG:  database system is ready to accept connections
yamz_1      | ice: starting ...
yamz_1      | Table Users pool: ([], 1001)
yamz_1      | Table Terms pool: ([], 1001)
yamz_1      | Table Comments pool: ([], 1001)
yamz_1      | ice: setup complete.
yamz_1      |  * Serving Flask app "ice" (lazy loading)
yamz_1      |  * Environment: production
yamz_1      |    WARNING: Do not use the development server in a production environment.
yamz_1      |    Use a production WSGI server instead.
yamz_1      |  * Debug mode: on
yamz_1      |  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
yamz_1      | 172.19.0.1 - - [12/Sep/2018 01:37:36] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
yamz_1      | 172.19.0.1 - - [12/Sep/2018 01:37:36] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
yamz_1      | 172.19.0.1 - - [12/Sep/2018 01:37:36] "GET /?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -
yamz_1      | 172.19.0.1 - - [12/Sep/2018 01:37:36] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
yamz_1      | 172.19.0.1 - - [12/Sep/2018 01:37:36] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
yamz_1      | 172.19.0.1 - - [12/Sep/2018 01:37:36] "GET / HTTP/1.1" 500 -
yamz_1      | Traceback (most recent call last):
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2309, in __call__
yamz_1      |     return self.wsgi_app(environ, start_response)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2295, in wsgi_app
yamz_1      |     response = self.handle_exception(e)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1741, in handle_exception
yamz_1      |     reraise(exc_type, exc_value, tb)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
yamz_1      |     raise value
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
yamz_1      |     response = self.full_dispatch_request()
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
yamz_1      |     rv = self.handle_user_exception(e)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1713, in handle_user_exception
yamz_1      |     return self.handle_http_exception(e)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1644, in handle_http_exception
yamz_1      |     return handler(e)
yamz_1      |   File "/usr/src/app/ice.py", line 174, in pageNotFound
yamz_1      |     content = "The page you requested doesn't exist."), 404
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/templating.py", line 134, in render_template
yamz_1      |     return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 869, in get_or_select_template
yamz_1      |     return self.get_template(template_name_or_list, parent, globals)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 830, in get_template
yamz_1      |     return self._load_template(name, self.make_globals(globals))
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 804, in _load_template
yamz_1      |     template = self.loader.load(self, name, globals)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/jinja2/loaders.py", line 113, in load
yamz_1      |     source, filename, uptodate = self.get_source(environment, name)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/templating.py", line 58, in get_source
yamz_1      |     return self._get_source_fast(environment, template)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/templating.py", line 81, in _get_source_fast
yamz_1      |     for srcobj, loader in self._iter_loaders(template):
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/templating.py", line 89, in _iter_loaders
yamz_1      |     loader = self.app.jinja_loader
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/helpers.py", line 861, in __get__
yamz_1      |     value = self.func(obj)
yamz_1      |   File "/usr/local/lib/python3.7/site-packages/flask/helpers.py", line 936, in jinja_loader
yamz_1      |     self.template_folder))
yamz_1      |   File "/usr/local/lib/python3.7/posixpath.py", line 94, in join
yamz_1      |     genericpath._check_arg_types('join', a, *p)
yamz_1      |   File "/usr/local/lib/python3.7/genericpath.py", line 149, in _check_arg_types
yamz_1      |     (funcname, s.__class__.__name__)) from None
yamz_1      | TypeError: join() argument must be str or bytes, not 'bool'

Does someone else know how to ensure that the static files are served via http://0.0.0.0:5000/ ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant