Skip to content

Commit 81784c7

Browse files
committed
Update file with new info
1 parent 57c0120 commit 81784c7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

start_flask_server.md

+19
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,25 @@ Once you are done, we can update our `requirements.txt` file. This file contains
330330
(flask_project) $ pip freeze > requirements.txt
331331
```
332332

333+
## Brief on the Flask Server
334+
335+
The `flask run` command is used to start the flask application in a development server. This server provides an interactive debugger and reloads when it notices changes in code. It is intended for local use only since it is not designed to be particularly efficient, stable or secure.
336+
337+
> Prior to Flask 1.0 the FLASK_ENV environment variable was not supported and you needed to enable debug mode by exporting FLASK_DEBUG=1. This can still be used to control debug mode, but it is now preferred to set it as an evironment variable.
338+
339+
To stop your flask server, you can hit `ctrl + C`. However, when you hit `ctrl + Z`, you will notice a _traceback_ when you try restarting your flask server. You will be informed that the address you are trying to connect to is _already in use_.
340+
341+
```python
342+
* Serving Flask app 'blog.py' (lazy loading)
343+
* Environment: development
344+
* Debug mode: on
345+
Traceback (most recent call last):
346+
# ...
347+
OSError: [Errno 98] Address already in use
348+
```
349+
350+
To fix it, you need to identify and stop the other program or use the command `flask run --port 50001` to pick a different port.
351+
333352
## Going Further
334353

335354
This is a good starting point for your Flask learning. You can build on this project by adding more routes, templates, and view functions. You can even learn how to use webforms and a database with Flask. Things you can do:

0 commit comments

Comments
 (0)