For my project, I need to keep running both website and my Telegram bot in one code, but every time I start the code, this error pops up:
Serving Flask app 'flask_app' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
Address already in use
Port 5000 is in use by another program. Either identify and stop that program, or start the server with a different port.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/werkzeug/serving.py", line 908, in prepare_socket
s.bind(server_address)
OSError: [Errno 98] Address already in use
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/Andrzejek/flask_app.py", line 22, in <module>
app.run() #port=5001
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 920, in run
run_simple(t.cast(str, host), port, self, **options)
File "/usr/local/lib/python3.10/site-packages/werkzeug/serving.py", line 1059, in run_simple
s = prepare_socket(hostname, port)
File "/usr/local/lib/python3.10/site-packages/werkzeug/serving.py", line 927, in prepare_socket
sys.exit(1)
SystemExit: 1
How can I fix it?