Last active
April 19, 2021 16:36
-
-
Save blu3r4y/d5fa243d4343b1aa871e3b76fb55089c to your computer and use it in GitHub Desktop.
Running two flask apps with circus
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
from circus import get_arbiter | |
alice = dict( | |
name="alice", | |
cmd="python -m flask run --port=81", | |
env={"FLASK_APP": "flask_alice.py"}, | |
copy_env=True, | |
copy_path=True, | |
) | |
bob = dict( | |
name="bob", | |
cmd="python -m flask run --port=82", | |
env={"FLASK_APP": "flask_bob.py"}, | |
copy_env=True, | |
copy_path=True, | |
) | |
arbiter = get_arbiter([alice, bob]) | |
try: | |
arbiter.start() | |
finally: | |
arbiter.stop() |
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
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello_alice(): | |
return "Hi, my name is Alice!" |
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
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello_bob(): | |
return "Hi, this is Bob!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment