How to deploy NiceGUI application to Heroku? #25
-
I tried to deploy hellord app on Heroku:
and I have error:
Is possible to deploy on Heroku? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Thanks for your feedback! You spotted an issue in NiceGUI's pre-evaluation of the But we can avoid terminating the whole app and simply continue evaluating the script in a so-called interactive mode (same as if NiceGUI is used in an interactive Python shell). The auto-reloading feature does not work here, but at least the UI starts as expected and whatever expression is passed to Please have a try with version 0.7.13. I haven't tested it on Heroku, yet. But I'm pretty confident that this new release will solve your issue. |
Beta Was this translation helpful? Give feedback.
-
The new NiceGUI version 0.7.15 should finally work nicely on Heroku. The main issue was that the environment variable In the meantime I thought using Heroku's default setting of So my final setup is as follows: main.py from nicegui import ui
label = ui.label('Hello NiceGUI!')
ui.button('BUTTON', on_click=lambda: label.set_text(label.text + '!'))
ui.run() Procfile
requirements.txt
runtime.txt
|
Beta Was this translation helpful? Give feedback.
The new NiceGUI version 0.7.15 should finally work nicely on Heroku. The main issue was that the environment variable
PORT
has been overwritten by the import statementfrom nicegui import ui
. But now the variablesHOST
andPORT
- if defined - will be read and used duringui.run()
. So you don't even need to read them viaos.getenv
and pass them toui.run
.In the meantime I thought using Heroku's default setting of
WEB_CONCURRENCY=2
might be an issue. So I experimented with setting it to 1. But with version 0.7.15 this step is probably not necessary anymore.So my final setup is as follows:
main.py