fix flask turbo compatibilty with gunicorn
This commit is contained in:
parent
1ed8d6ef17
commit
d0f29e784f
|
@ -9,4 +9,6 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||
COPY . /usr/src/app
|
||||
|
||||
EXPOSE 8080
|
||||
CMD echo "$PGCACERT" | base64 --decode > ca.cer && echo "$PGCLIENTCERT" | base64 --decode > client.cer && echo "$PGCLIENTKEY" | base64 --decode > client-key.cer && gunicorn app:webapp --bind 0.0.0.0:8080
|
||||
CMD \
|
||||
echo "$PGCACERT" | base64 --decode > ca.cer && echo "$PGCLIENTCERT" | base64 --decode > client.cer && echo "$PGCLIENTKEY" | base64 --decode > client-key.cer && \
|
||||
gunicorn app:webapp --threads 100 --bind 0.0.0.0:8080
|
||||
|
|
|
@ -22,6 +22,11 @@ source .venv/bin/activate
|
|||
SOLANA_CLUSTER=testnet PGDATABASE=da11copy PGUSER=query_user PGPASSWORD=secret TEMPLATES_AUTO_RELOAD=True flask run --port 5050 --debug --reload
|
||||
```
|
||||
|
||||
Use this to test with _gunicorn_:
|
||||
```
|
||||
SOLANA_CLUSTER=testnet PGDATABASE=da11copy PGPORT=5432 PGUSER=query_user PGPASSWORD=secret TEMPLATES_AUTO_RELOAD=True gunicorn app:webapp --bind :5050 --reload
|
||||
```
|
||||
|
||||
Open Firefox Browser and navigate to ...
|
||||
* [Dashboard](http://localhost:5050/dashboard)
|
||||
* [Blocks and Tx Errors](http://localhost:5050/recent-blocks)
|
||||
|
|
3
app.py
3
app.py
|
@ -1,9 +1,11 @@
|
|||
from flask import Flask, render_template, request, make_response, redirect
|
||||
from flask_sock import Sock
|
||||
from turbo_flask import Turbo
|
||||
import threading
|
||||
import time
|
||||
from flask_htmx import HTMX
|
||||
import re
|
||||
import flask
|
||||
|
||||
import transaction_database
|
||||
import recent_blocks_database
|
||||
|
@ -17,6 +19,7 @@ import config
|
|||
webapp = Flask(__name__)
|
||||
# https://blog.miguelgrinberg.com/post/dynamically-update-your-flask-web-pages-using-turbo-flask
|
||||
turbo = Turbo(webapp)
|
||||
sock = Sock(webapp)
|
||||
htmx = HTMX(webapp)
|
||||
|
||||
webapp.update_thread_started = False
|
||||
|
|
Loading…
Reference in New Issue