Last active
November 15, 2020 10:02
-
-
Save Audhil/0570c90fa9dc56b0e67b1f9cfd6b6d98 to your computer and use it in GitHub Desktop.
Python Flask server connection with Android app - https://android.jlelse.eu/handmade-backend-for-android-app-using-python-flask-framework-b173ba2bb3aa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# development way | |
if __name__ == '__main__': | |
app.run() | |
## server on http://127.0.0.1:5000/ | |
## (invisible across the network) won't work on other device, other than development machine | |
# suggested way | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', port=5000) | |
## server on http://0.0.0.0:5000/ | |
## visible across the network | |
## BaseUrl for Android http://<your ip address>:5000/blah/blah | |
# hackiest way (not preferred) | |
if __name__ == '__main__': | |
app.run(host='<your ip address>') | |
## server on http://<your ip address>:5000/ | |
## visible across the network | |
## BaseUrl for Android http://<your ip address>:5000/blah/blah | |
## whereas port=5000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment