Execution en serveur gunicorn
This commit is contained in:
@@ -10,7 +10,7 @@ Outil d'exploration et de téléchargement des données essentielles de la comma
|
|||||||
python -m venv .venv
|
python -m venv .venv
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip install .
|
pip install .
|
||||||
python src/app.py
|
gunicorn app:server
|
||||||
```
|
```
|
||||||
## Dépôts de code connexes
|
## Dépôts de code connexes
|
||||||
|
|
||||||
|
|||||||
+21
-4
@@ -1,14 +1,20 @@
|
|||||||
from dash import Dash, html, dcc, callback, Output, Input, dash_table
|
from dash import Dash, html, dcc, callback, Output, Input, dash_table
|
||||||
import plotly.express as px
|
import plotly.express as px
|
||||||
import polars as pl
|
import polars as pl
|
||||||
|
import dash_bootstrap_components as dbc
|
||||||
|
|
||||||
df = pl.read_parquet(
|
df = pl.read_ipc("/home/colin/git/decp-processing/dist/decp.arrow")
|
||||||
"https://www.data.gouv.fr/fr/datasets/r/11cea8e8-df3e-4ed1-932b-781e2635e432"
|
|
||||||
)
|
|
||||||
|
|
||||||
app = Dash()
|
app = Dash(external_stylesheets=[dbc.themes.UNITED])
|
||||||
|
server = app.server
|
||||||
|
|
||||||
app.layout = [
|
app.layout = [
|
||||||
|
html.Div(
|
||||||
|
[
|
||||||
|
"Recherche (acheteur, titulaire, objet) : ",
|
||||||
|
dcc.Input(id="search", value="", type="text"),
|
||||||
|
]
|
||||||
|
),
|
||||||
html.H1(children="decp.info", style={"textAlign": "center"}),
|
html.H1(children="decp.info", style={"textAlign": "center"}),
|
||||||
dash_table.DataTable(
|
dash_table.DataTable(
|
||||||
id="table",
|
id="table",
|
||||||
@@ -29,6 +35,17 @@ app.layout = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@callback(
|
||||||
|
Output(component_id="table", component_property="data", allow_duplicate=True),
|
||||||
|
Input(component_id="search", component_property="value"),
|
||||||
|
prevent_initial_call=True,
|
||||||
|
)
|
||||||
|
def global_search(text):
|
||||||
|
new_df = df
|
||||||
|
new_df = new_df.filter(pl.col("objet").str.contains("(?i)" + text))
|
||||||
|
return new_df.to_dicts()
|
||||||
|
|
||||||
|
|
||||||
@callback(
|
@callback(
|
||||||
Output("table", "data"), Input("table", "page_current"), Input("table", "page_size")
|
Output("table", "data"), Input("table", "page_current"), Input("table", "page_size")
|
||||||
)
|
)
|
||||||
+2
-1
@@ -8,7 +8,8 @@ authors = [
|
|||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dash",
|
"dash",
|
||||||
"polars"
|
"polars",
|
||||||
|
"gunicorn"
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
|
|||||||
Reference in New Issue
Block a user