added subdomain to flask routes

This commit is contained in:
Sakimori 2021-02-26 02:26:45 -05:00
parent 65fde63898
commit dc8da40d68

View file

@ -7,12 +7,13 @@ import database as db
app = Flask("the-prestige", static_folder='simmadome/build')
app.config['SECRET KEY'] = 'dev'
#app.config['SERVER_NAME'] = '0.0.0.0:5000'
#url = "sakimori.space:5000"
#app.config['SERVER_NAME'] = url
socketio = SocketIO(app)
# Serve React App
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
@app.route('/', defaults={'path': ''}, subdomain = "simsim")
@app.route('/<path:path>', subdomain = "simsim")
def serve(path):
if path != "" and os.path.exists(app.static_folder + '/' + path):
return send_from_directory(app.static_folder, path)
@ -21,7 +22,7 @@ def serve(path):
### API
@app.route('/api/teams/search')
@app.route('/api/teams/search', subdomain = "simsim")
def search_teams():
query = request.args.get('query')
page_len = int(request.args.get('page_len'))
@ -41,7 +42,7 @@ def search_teams():
MAX_SUBLEAGUE_DIVISION_TOTAL = 22;
MAX_TEAMS_PER_DIVISION = 12;
@app.route('/api/leagues', methods=['POST'])
@app.route('/api/leagues', methods=['POST'], subdomain = "simsim")
def create_league():
config = json.loads(request.data)
@ -113,7 +114,7 @@ def create_league():
### SOCKETS
thread2 = threading.Thread(target=socketio.run,args=(app,'0.0.0.0'))
thread2 = threading.Thread(target=socketio.run,args=(app,'sakimori.space:5000'))
thread2.start()
master_games_dic = {} #key timestamp : (game game, {} state)