posborne / putio-sync

Python daemon that automatically downloads files from put.io
MIT License
29 stars 12 forks source link

WebUI #37

Open AndersTao opened 7 years ago

AndersTao commented 7 years ago

I have a problem when opening the WebUI from a ubuntu server, with no GUI. Running from my mac, it works fine, and the webUI opens automatically.

On Ubuntu 16.04 Server I get this message:

2016-11-15 10:00:59,622 | putiosync.webif.webif | ERROR    | Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "build/bdist.linux-x86_64/egg/putiosync/webif/webif.py", line 145, in _view_active
    return render_template("active.html")
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 127, in render_template
    return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 851, in get_or_select_template
    return self.get_template(template_name_or_list, parent, globals)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 812, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 774, in _load_template
    cache_key = self.loader.get_source(self, name)[1]
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 60, in get_source
    return loader.get_source(environment, local_name)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/loaders.py", line 171, in get_source
    f = open_if_exists(filename)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/utils.py", line 151, in open_if_exists
    return open(filename, mode)
IOError: [Errno 20] Not a directory: '/usr/local/lib/python2.7/dist-packages/putiosync-0.2.3-py2.7.egg/putiosync/webif/templates/active.html'

I get the samme message running putio-sync from a docker contaner with this config

FROM ubuntu:latest

ENV DEBIAN_FRONTEND noninteractive
ENV HOME="/putio-sync"

RUN apt-get update \
    && apt-get -y upgrade \
    && apt-get install -y \
    git \
    python-dev \
    python-pip \
    python-setuptools

RUN apt-get clean && \
    rm -rf \
    /tmp/* \
    /var/lib/apt/lists/* \
    /var/tmp/* \
    /var/tmp/*

RUN git clone https://github.com/posborne/putio-sync.git /putio-sync

RUN pip install --upgrade pip \
    && pip install -r /putio-sync/requirements.txt

RUN cd /putio-sync && python setup.py install

ADD run.sh /run.sh

VOLUME /downloads
EXPOSE 7001

CMD ["/run.sh"]

Can it be the Python version, or some missing dependency?

posborne commented 7 years ago

Hmmm, I'm wondering if something could be up with the setuptools config that is omitting the .html files from being installed. I think that would cause the problems. I know they are making it into the pypi package but haven't tested the install into another directory recently (perhaps since adding the webif).

AndersTao commented 7 years ago

Just found this in the build output

reading manifest template 'MANIFEST.in'
warning: no files found matching '*.html' under directory 'putiosync/webif/static'

Here is the full build output in a git: https://gist.github.com/AndersTao/899b0ef2d788774918adaf81594e5cbe#file-shell-out-L1028