-
-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement redis storage for app.storage.user and began with redis_sto…
…rage example
- Loading branch information
Showing
8 changed files
with
99 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM zauberzeug/nicegui:2.8.0 | ||
|
||
RUN python -m pip install redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
services: | ||
x-nicegui: &nicegui-service | ||
build: | ||
context: . | ||
environment: | ||
- NICEGUI_REDIS_URL=redis://redis:6379 | ||
volumes: | ||
- ./:/app | ||
- ../../nicegui:/app/nicegui | ||
labels: | ||
- traefik.enable=true | ||
- traefik.http.routers.nicegui.rule=PathPrefix(`/`) | ||
- traefik.http.services.nicegui.loadbalancer.server.port=8080 | ||
- traefik.http.services.nicegui.loadbalancer.sticky.cookie=true | ||
|
||
nicegui1: | ||
<<: *nicegui-service | ||
|
||
nicegui2: | ||
<<: *nicegui-service | ||
|
||
redis: | ||
image: redis:alpine | ||
ports: | ||
- "6379:6379" | ||
|
||
proxy: | ||
image: traefik:v2.10 | ||
command: | ||
- --providers.docker | ||
- --entrypoints.web.address=:80 | ||
ports: | ||
- "8080:80" | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
from nicegui import app, ui | ||
|
||
|
||
@ui.page('/') | ||
def index(): | ||
ui.input('general').bind_value(app.storage.general, 'text') | ||
ui.input('user').bind_value(app.storage.user, 'text') | ||
|
||
|
||
ui.run(storage_secret='your private key to secure the browser session cookie') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from .file_persistent_dict import FilePersistentDict | ||
from .persistent_dict import PersistentDict | ||
from .read_only_dict import ReadOnlyDict | ||
from .redis_persistent_dict import RedisPersistentDict | ||
|
||
__all__ = [ | ||
'FilePersistentDict', | ||
'PersistentDict', | ||
'ReadOnlyDict', | ||
'RedisPersistentDict', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters