Skip to content

Instantly share code, notes, and snippets.

@blu3r4y
Last active April 19, 2021 16:36
Show Gist options
  • Save blu3r4y/d5fa243d4343b1aa871e3b76fb55089c to your computer and use it in GitHub Desktop.
Save blu3r4y/d5fa243d4343b1aa871e3b76fb55089c to your computer and use it in GitHub Desktop.
Running two flask apps with circus
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()
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_alice():
return "Hi, my name is Alice!"
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