micahflee / semiphemeral

Automatically delete your old tweets, except for the ones you want to keep
MIT License
884 stars 85 forks source link

Templates aren't included in pip package #1

Closed micahflee closed 5 years ago

micahflee commented 5 years ago

Oops. From a comment on my blog post:

When running "semiphemeral configure", I get the following error: >jinja2.exceptions.TemplateNotFound: settings.html

I installed it with "pip3 semiphemeral", and for some reason, the template files are not included in the directory .local/lib/python3.5/site-packages/semiphemeral/.

I'm using Debian 9.

KonradIT commented 5 years ago

Can confirm this as well.

konrad@konrad-pc [~]: semiphemeral configure
semiphemeral 0.1
Load this website in a browser to configure semiphemeral, and press Ctrl-C when done
http://127.0.0.1:8080

 * Serving Flask app "semiphemeral.web" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
127.0.0.1 - - [05/Jun/2019 19:00:22] "GET / HTTP/1.1" 302 -
[2019-06-05 19:00:23,010] ERROR in app: Exception on /settings [GET]
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.7/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python3.7/site-packages/semiphemeral/web.py", line 75, in edit_settings
    retweets_likes_likes_threshold=common.settings.get('retweets_likes_likes_threshold'))
  File "/usr/lib/python3.7/site-packages/flask/templating.py", line 134, in render_template
    return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
  File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 869, in get_or_select_template
    return self.get_template(template_name_or_list, parent, globals)
  File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 830, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 804, in _load_template
    template = self.loader.load(self, name, globals)
  File "/usr/lib/python3.7/site-packages/jinja2/loaders.py", line 113, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "/usr/lib/python3.7/site-packages/flask/templating.py", line 58, in get_source
    return self._get_source_fast(environment, template)
  File "/usr/lib/python3.7/site-packages/flask/templating.py", line 86, in _get_source_fast
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: settings.html
127.0.0.1 - - [05/Jun/2019 19:00:23] "GET /settings HTTP/1.1" 500 -

konrad@konrad-pc [~]: python --version
Python 3.7.3
konrad@konrad-pc [~]: uname -a
Linux konrad-pc 5.1.6-arch1-1-ARCH #1 SMP PREEMPT Fri May 31 15:17:53 UTC 2019 x86_64 GNU/Linux
micahflee commented 5 years ago

Just released semiphemeral 0.2, which fixes this: https://pypi.org/project/semiphemeral/0.2/

@KonradIT can you try running pip3 install --upgrade semiphemeral and let me know if it's still happening for you?

KonradIT commented 5 years ago

@micahflee Template rendering works.

micahflee commented 5 years ago

Hurray