My configurations and cheatsheets for most text-editors and language-specific frameworks I use in my tech stack.
cd
into your your source and then use
python3 -m venv venv # makes a venv called "venv"
Activate your recently developed venv
using:
source venv/bin/activate
Make sure that you are in the same directory as your venv
to run the command.
Use the following boilerplate code to make your source file:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "Hello world"
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000, debug=True)
Export the flask app using:
export FLASK_APP=app.py
(Optional) Change the development environment:
export FLASK_ENV=debug # runs in debug mode and facilitates automatic refreshing for frontend changes
Make the code publicly available to everyone in localhost:
flask run --host=0.0.0.0 --port=8000 # also stops interference with nginx