Skip to content

Reloadium on pycharm won't load Flask templates #20

@pommepommee

Description

@pommepommee

Describe the bug
I tried the reloadium plugin for PyCharm for my Flask project. The problem is reloadium cannot found the index.html template used in my project.

Here is the error :

C:\Users\tom52\Desktop\projet>reloadium run app.py
■■■■■■■■■■■■■■■
Reloadium 0.8.8
■■■■■■■■■■■■■■■
If you like this project consider becoming a sponsor or giving a start at https://github.com/reloadware/reloadium
 * Serving Flask app '__main__' (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
INFO:werkzeug: * Running on http://127.0.0.1:5000 (Press CTRL+C to quit)

Loaded 3 watched modules so far from paths:
 - \C:\Users\tom52\Desktop\projet\**\*.html
 - \C:\Users\tom52\Desktop\projet\**\*.py

ERROR:__main__:Exception on / [GET]
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\flask\app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Python310\lib\site-packages\flask\app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Python310\lib\site-packages\flask\app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Python310\lib\site-packages\reloadium\reloader\llll11l1l1l1l1llIl1l1\llllll1l1ll111l1Il1l1.py", line 165, in ll11ll1ll11ll111Il1l1
  File "C:\Python310\lib\site-packages\flask\app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "C:\Users\tom52\Desktop\projet\app.py", line 28, in index
    return render_template('index.html', history=history)
  File "C:\Python310\lib\site-packages\flask\templating.py", line 149, in render_template
    ctx.app.jinja_env.get_or_select_template(template_name_or_list),
  File "C:\Python310\lib\site-packages\jinja2\environment.py", line 1081, in get_or_select_template
    return self.get_template(template_name_or_list, parent, globals)
  File "C:\Python310\lib\site-packages\jinja2\environment.py", line 1010, in get_template
    return self._load_template(name, globals)
  File "C:\Python310\lib\site-packages\jinja2\environment.py", line 969, in _load_template
    template = self.loader.load(self, name, self.make_globals(globals))
  File "C:\Python310\lib\site-packages\jinja2\loaders.py", line 126, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "C:\Python310\lib\site-packages\flask\templating.py", line 59, in get_source
    return self._get_source_fast(environment, template)
  File "C:\Python310\lib\site-packages\flask\templating.py", line 95, in _get_source_fast
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: index.html
INFO:werkzeug:127.0.0.1 - - [06/Jun/2022 22:24:08] "GET / HTTP/1.1" 500 -

To Reproduce
Steps to reproduce the behavior:

  1. Create a python flask project with the following files tree:
project/
      | app.py
      | templates/
          | index.html
  1. Create a templates directory and add index.html
  2. create the app in python with app = Flask(__name__, template_folder='templates') and app.run()
  3. run reloadium run app.py

Expected behavior
As the Flask constructor specifies the template folder, the flask app should run correctly

Screenshots

  • Running the code by python app.py or PyCharm (same result)
    image

  • Running the code with console reloadium or pycharm reloadium (same result)
    image

Desktop (please complete the following information):

  • OS: Windows
  • OS version: Windows 11 Professional - Version 21H2 - build 22000.675
  • Reloadium package version: 0.8.8
  • PyCharm plugin version: 0.8.2
  • Editor: PyCharm
  • Run mode: Run & Debug

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions