Run the Dev Server with Debug Mode
Start flask run, enable debug, and read the reloader.
Run the Dev Server with Debug Mode is a free Flask Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Flask Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Dev Server
Flask includes a built-in development server so you can run your app instantly while building, with no extra setup. 🛠️
Start with flask run
The recommended way to launch is the flask run command, which finds your app and serves it on the local port.
flask runTell Flask Your App
Set the FLASK_APP variable so the command knows which file holds your application object.
export FLASK_APP=app.pyThe Default Address
By default the server listens on 127.0.0.1:5000, reachable only from your own machine while you develop.
Turn On Debug Mode
Debug mode unlocks two big helpers: a live reloader and a rich error page. Enable it while developing only.
flask run --debugThe Auto Reloader
With debug on, the reloader watches your files and restarts the server whenever you save a change. No manual restarts. ♻️
The Interactive Debugger
When code crashes, debug mode shows a detailed traceback in the browser so you can pinpoint the failing line fast.
Set Debug in Code
You can also flip debug on inside app.run, handy when you launch the file directly with python.
app.run(debug=True)Reading the Reloader Output
The console prints a line each time it reloads, confirming your edits were picked up and the server is fresh.
Never Debug in Production
The debugger can run arbitrary code, so it is a serious security risk. Keep debug mode off on any public server.
Stop the Server
Press Ctrl+C in the terminal to shut the dev server down cleanly when you are finished working.
Quick Check
Quick check on what debug mode gives you.
Recap
You ran the dev server with flask run, enabled debug for the reloader and debugger, and learned to keep it off in production. 🔒
Frequently asked questions
Is the “Run the Dev Server with Debug Mode” lesson free?
Yes — the full text of “Run the Dev Server with Debug Mode” is free to read here on the web, and the Flask Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Flask Academy course, upgrade to CoddyKit PRO.
What will I learn in “Run the Dev Server with Debug Mode”?
Start flask run, enable debug, and read the reloader. You practise Flask Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Flask Academy?
No prior experience is required. Flask Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Run the Dev Server with Debug Mode” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Flask Academy lesson?
Yes. Every Flask Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What Flask Is and Why It Exists
- Set Up a Virtualenv and Install Flask
- Hello World: Your First Flask App
- Run the Dev Server with Debug Mode