-
Notifications
You must be signed in to change notification settings - Fork 8
Commit v0.3
kwmccabe edited this page Apr 17, 2018
·
14 revisions
v0.3 - Hello PythonDebugger
- +4 -0 [M] docker-compose.yml
- +1 -1 [M] web/entrypoint.sh
- +14 -1 [M] web/flaskapp.py
-
stdin_open
: Open STDIN for debugger (--interactive , -i) -
tty
: Allocate a pseudo-TTY for debugger (--tty , -t)
command: ./entrypoint.sh
volumes:
- ./web:/web
+ stdin_open: true
+ tty: true
-
--timeout
: Extend worker lifetime 30 to 3600 to allow debugging session
flaskapp:app \
--bind :8000 \
--workers 2 \
- --timeout 3600 \
--access-logfile logs/gunicorn-access.log \
--error-logfile logs/gunicorn-error.log \
--log-level info \
+ --timeout 3600 \
--reload
- Create route
/debug
and methodhello_debug()
to test the PythonDebugger.
+# run 'docker ps' to get the flaskapp_web CONTAINER_ID
+# run 'docker attach CONTAINER_ID' to connect a terminal session
+# pdb.set_trace() will launch the debugger in the attached terminal
+# see https://docs.python.org/3.6/library/pdb.html?highlight=pdb#debugger-commands
+@app.route('/debug')
+def hello_debug():
+ import pdb; pdb.set_trace()
+ return "Hello Python Debugger"
Commit-v0.2 | Commit-v0.3 | Commit-v0.4
- FlaskApp Tutorial
- Table of Contents
- About
- Application Setup
- Modules, Templates, and Layouts
- Database Items, Forms, and CRUD
- List Filter, Sort, and Paginate
- Users and Login
- Database Relationships
- API Module, HTTPAuth and JSON
- Refactoring User Roles and Item Status
- AJAX and Public Pages