mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
Enable remote debugging with ptvsd (#3419)
* open port 3000 for remote debugging * add ptvsd * use port 5678 to avoid changes in VSCode's default config * attach to ptvsd * no need to wait for attach * actually, --debugger seems to be working * create a new docker entry point for remote debugging * alternative method to switch to debugging
This commit is contained in:
@@ -39,6 +39,7 @@ help() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "shell -- open shell"
|
echo "shell -- open shell"
|
||||||
echo "dev_server -- start Flask development server with debugger and auto reload"
|
echo "dev_server -- start Flask development server with debugger and auto reload"
|
||||||
|
echo "debug -- start Flask development server with remote debugger via ptvsd"
|
||||||
echo "create_db -- create database tables"
|
echo "create_db -- create database tables"
|
||||||
echo "manage -- CLI to manage redash"
|
echo "manage -- CLI to manage redash"
|
||||||
echo "tests -- run tests"
|
echo "tests -- run tests"
|
||||||
@@ -72,6 +73,11 @@ case "$1" in
|
|||||||
export FLASK_DEBUG=1
|
export FLASK_DEBUG=1
|
||||||
exec /app/manage.py runserver --debugger --reload -h 0.0.0.0
|
exec /app/manage.py runserver --debugger --reload -h 0.0.0.0
|
||||||
;;
|
;;
|
||||||
|
debug)
|
||||||
|
export FLASK_DEBUG=1
|
||||||
|
export REMOTE_DEBUG=1
|
||||||
|
exec /app/manage.py runserver --debugger --no-reload -h 0.0.0.0
|
||||||
|
;;
|
||||||
shell)
|
shell)
|
||||||
exec /app/manage.py shell
|
exec /app/manage.py shell
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ services:
|
|||||||
- redis
|
- redis
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
|
- "5678:5678"
|
||||||
volumes:
|
volumes:
|
||||||
- ".:/app"
|
- ".:/app"
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ from redash.destinations import import_destinations
|
|||||||
__version__ = '6.0.0'
|
__version__ = '6.0.0'
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
if os.environ.get("REMOTE_DEBUG"):
|
||||||
|
import ptvsd
|
||||||
|
ptvsd.enable_attach(address=('0.0.0.0', 5678))
|
||||||
|
|
||||||
|
|
||||||
def setup_logging():
|
def setup_logging():
|
||||||
handler = logging.StreamHandler(sys.stdout if settings.LOG_STDOUT else sys.stderr)
|
handler = logging.StreamHandler(sys.stdout if settings.LOG_STDOUT else sys.stderr)
|
||||||
formatter = logging.Formatter(settings.LOG_FORMAT)
|
formatter = logging.Formatter(settings.LOG_FORMAT)
|
||||||
|
|||||||
@@ -8,3 +8,4 @@ mock==2.0.0
|
|||||||
pymongo[tls,srv]==3.6.1
|
pymongo[tls,srv]==3.6.1
|
||||||
botocore==1.12.85
|
botocore==1.12.85
|
||||||
PyAthena>=1.0.0
|
PyAthena>=1.0.0
|
||||||
|
ptvsd==4.2.3
|
||||||
|
|||||||
Reference in New Issue
Block a user