Skip to content

How to deploy NiceGUI application to Heroku? #25

Closed Answered by falkoschindler
200729 asked this question in Q&A
Discussion options

You must be logged in to vote

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 statement from nicegui import ui. But now the variables HOST and PORT - if defined - will be read and used during ui.run(). So you don't even need to read them via os.getenv and pass them to ui.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

from nicegui import ui

label = ui.label('Hello NiceGUI!')
ui.button('BUTTON', on_click=lambda: 

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
5 replies
@200729
Comment options

@falkoschindler
Comment options

@200729
Comment options

@falkoschindler
Comment options

@falkoschindler
Comment options

Comment options

You must be logged in to vote
4 replies
@200729
Comment options

@alikalik9
Comment options

@falkoschindler
Comment options

@alikalik9
Comment options

Answer selected by 200729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants