powa-team / powa-web

PoWA user interface
http://powa.readthedocs.io/
74 stars 31 forks source link

Fix path to vite built manifest.json #192

Closed pgiraud closed 4 months ago

rjuju commented 11 months ago

Is it to fix the current problem when trying to run a non-debug powa-web with the new vue3 version? I actually faced that problem and forgot to report it.

pgiraud commented 11 months ago

Yes. Exactly. I didn't expect this change. I detected it after a try in non-debug mode.

pgiraud commented 11 months ago

I'll work on this a bit more. Because the documentation about this feature has changed. https://vitejs.dev/guide/backend-integration

rjuju commented 11 months ago

Ok great, thanks a lot. And sure, take the time you need we won't need that before release time anyway.

rjuju commented 5 months ago

hi, any news on this?

pgiraud commented 5 months ago

hi, any news on this?

Thanks for the reminder. I should be able to give this a new try next week.

rjuju commented 5 months ago

Thanks a lot. For the record I plan to merge all the v5 related stuff in the main branches soon, as I could finish most of the other related tasks, so if you have anything you want to add for the beta let me know.

pgiraud commented 4 months ago

Branch rebased and code updated. For me, it's now good to go.

rjuju commented 4 months ago

thanks a lot, I will look at it this weekend!

rjuju commented 4 months ago

I'm probably doing something wrong, but if I run the non debug powa-web, I now get an explicit error:

$ ./powa-web
[I 240629 09:51:41 powa-web:38] Starting powa-web on http://0.0.0.0:8888/
[E 240629 09:51:43 web:1875] Uncaught exception GET /server/ (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/server/', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/rjuju/.virtualenvs/pypowa/lib/python3.12/site-packages/tornado/web.py", line 1788, in _execute
        result = method(*self.path_args, **self.path_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/rjuju/git/powa/powa-web/powa/dashboards.py", line 94, in get
        return self.render(self.template, title=title)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/rjuju/.virtualenvs/pypowa/lib/python3.12/site-packages/tornado/web.py", line 944, in render
        html = self.render_string(template_name, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/rjuju/.virtualenvs/pypowa/lib/python3.12/site-packages/tornado/web.py", line 1093, in render_string
        return t.generate(**namespace)
               ^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/rjuju/.virtualenvs/pypowa/lib/python3.12/site-packages/tornado/template.py", line 362, in generate
        return execute()
               ^^^^^^^^^
      File "fullpage_dashboard_html.generated.py", line 58, in _tt_execute
        for css in manifest('powa/static/js/main.js')['css']:  # layout.html:67
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/rjuju/.virtualenvs/pypowa/lib/python3.12/site-packages/tornado/web.py", line 1894, in <lambda>
        return lambda *args, **kwargs: method(self, *args, **kwargs)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/rjuju/git/powa/powa-web/powa/ui_methods.py", line 148, in manifest
        with open(fn) as f:
             ^^^^^^^^
    FileNotFoundError: [Errno 2] No such file or directory: '/home/rjuju/git/powa/powa-web/powa/static/dist/.vite/manifest.json'
[E 240629 09:51:43 web:2348] 500 GET /server/ (127.0.0.1) 18.59ms

I did a npm ci && npm run dev

pgiraud commented 4 months ago

npm run dev is for the debug. It launches a ViteJS server which serves the assets. To run powa in non debug mode, you need to run npm run build.

The idea is to do the build and commit the generated files each time we do a new release.

rjuju commented 4 months ago

oh I see

yes I agree with committing the generated assets, it will make deployment so much easier.

but is it possible to have better error reporting in that situation? I'm assuming it could also happen if you hit an error when generating the assets or some other corner case scenario.

pgiraud commented 4 months ago

I made the error message in the log a bit more self-explaining.

rjuju commented 4 months ago

That's great, thanks a lot!