Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable remote debugging with ptvsd #3419

Merged
merged 13 commits into from
Feb 12, 2019
6 changes: 6 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ help() {
echo ""
echo "shell -- open shell"
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 "manage -- CLI to manage redash"
echo "tests -- run tests"
Expand Down Expand Up @@ -72,6 +73,11 @@ case "$1" in
export FLASK_DEBUG=1
exec /app/manage.py runserver --debugger --reload -h 0.0.0.0
;;
debug)
export FLASK_DEBUG=1
arikfr marked this conversation as resolved.
Show resolved Hide resolved
export REMOTE_DEBUG=1
exec /app/manage.py runserver --debugger --no-reload -h 0.0.0.0
;;
shell)
exec /app/manage.py shell
;;
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
- redis
ports:
- "5000:5000"
- "5678:5678"
volumes:
- ".:/app"
environment:
Expand Down
6 changes: 6 additions & 0 deletions redash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
__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():
handler = logging.StreamHandler(sys.stdout if settings.LOG_STDOUT else sys.stderr)
formatter = logging.Formatter(settings.LOG_FORMAT)
Expand Down
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ mock==2.0.0
pymongo[tls,srv]==3.6.1
botocore==1.12.85
PyAthena>=1.0.0
ptvsd==4.2.3