mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
try: ditch waitress
This commit is contained in:
@@ -67,6 +67,7 @@ def create_api():
|
||||
|
||||
app = OpenAPI(__name__, info=api_info, doc_prefix="/docs")
|
||||
# JWT CONFIGS
|
||||
app.config["JWT_VERIFY_SUB"] = False
|
||||
app.config["JWT_SECRET_KEY"] = UserConfig().serverId
|
||||
app.config["JWT_TOKEN_LOCATION"] = ["cookies", "headers"]
|
||||
app.config["JWT_COOKIE_CSRF_PROTECT"] = False
|
||||
|
||||
+18
-2
@@ -3,11 +3,12 @@ Contains all the track routes.
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import time
|
||||
from typing import Literal
|
||||
|
||||
from flask import send_file, request, Response
|
||||
from flask import send_file, request, Response, send_from_directory
|
||||
from flask_openapi3 import APIBlueprint, Tag
|
||||
from pydantic import BaseModel, Field
|
||||
from app.api.apischemas import TrackHashSchema
|
||||
@@ -84,7 +85,22 @@ def send_track_file_legacy(path: TrackHashSchema, query: SendTrackFileQuery):
|
||||
|
||||
if track is not None:
|
||||
audio_type = guess_mime_type(filepath)
|
||||
return send_file(filepath, mimetype=audio_type, conditional=True)
|
||||
# return send_file(
|
||||
# filepath,
|
||||
# mimetype=audio_type,
|
||||
# conditional=True,
|
||||
# # environ=request.environ,
|
||||
# as_attachment=True,
|
||||
# max_age=None,
|
||||
# )
|
||||
return send_from_directory(
|
||||
Path(filepath).parent,
|
||||
Path(filepath).name,
|
||||
mimetype=audio_type,
|
||||
conditional=True,
|
||||
as_attachment=True,
|
||||
)
|
||||
# return ""
|
||||
|
||||
return msg, 404
|
||||
|
||||
|
||||
+9
-2
@@ -1,8 +1,15 @@
|
||||
from locust import HttpUser, task
|
||||
|
||||
|
||||
class HelloWorldUser(HttpUser):
|
||||
host = "http://localhost:1980"
|
||||
|
||||
# @task
|
||||
# def get_all_artists(self):
|
||||
# self.client.get(
|
||||
# "/getall/artists?start=0&limit=50&sortby=created_date&reverse=1"
|
||||
# )
|
||||
|
||||
@task
|
||||
def hello_world(self):
|
||||
self.client.get("/getall/artists?start=0&limit=50&sortby=created_date&reverse=1")
|
||||
def get_album_info(self):
|
||||
self.client.get("/artist/9e6781427eab4934")
|
||||
|
||||
@@ -229,17 +229,18 @@ if __name__ == "__main__":
|
||||
|
||||
load_into_mem()
|
||||
run_swingmusic()
|
||||
TrackStore.export()
|
||||
ArtistStore.export()
|
||||
# TrackStore.export()
|
||||
# ArtistStore.export()
|
||||
|
||||
host = FLASKVARS.get_flask_host()
|
||||
port = FLASKVARS.get_flask_port()
|
||||
|
||||
waitress.serve(
|
||||
app,
|
||||
host=host,
|
||||
port=port,
|
||||
threads=100,
|
||||
ipv6=True,
|
||||
ipv4=True,
|
||||
)
|
||||
# waitress.serve(
|
||||
# app,
|
||||
# host=host,
|
||||
# port=port,
|
||||
# threads=100,
|
||||
# ipv6=True,
|
||||
# ipv4=True,
|
||||
# )
|
||||
app.run(host=host, port=port, debug=False)
|
||||
|
||||
+39
-55
@@ -1,57 +1,41 @@
|
||||
[tool.poetry]
|
||||
name = "Swing music player"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["geoffrey45 <geoffreymungai45@gmail.com>"]
|
||||
package-mode = false
|
||||
[project]
|
||||
name = "swing_music"
|
||||
version = "2.0.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.10,<3.12"
|
||||
Flask = "^2.0.2"
|
||||
Flask-Cors = "^3.0.10"
|
||||
requests = "^2.27.1"
|
||||
Pillow = "^9.0.1"
|
||||
"colorgram.py" = "^1.2.0"
|
||||
tqdm = "^4.65.0"
|
||||
rapidfuzz = "^2.13.7"
|
||||
tinytag = ">=2.0.0"
|
||||
Unidecode = "^1.3.6"
|
||||
psutil = "^5.9.4"
|
||||
show-in-file-manager = "^1.1.4"
|
||||
flask-compress = "^1.13"
|
||||
tabulate = "^0.9.0"
|
||||
setproctitle = "^1.3.2"
|
||||
locust = "^2.20.1"
|
||||
waitress = "^2.1.2"
|
||||
watchdog = "^4.0.0"
|
||||
pendulum = "^3.0.0"
|
||||
flask-openapi3 = "^3.0.2"
|
||||
flask-jwt-extended = "^4.6.0"
|
||||
sqlalchemy = "^2.0.31"
|
||||
memory-profiler = "^0.61.0"
|
||||
sortedcontainers = "^2.4.0"
|
||||
xxhash = "^3.4.1"
|
||||
ffmpeg-python = "^0.2.0"
|
||||
schedule = "^1.2.2"
|
||||
dependencies = [
|
||||
"pillow>=11.1.0",
|
||||
"Flask>=3.1.0",
|
||||
"Flask-Cors>=3.0.10",
|
||||
"requests>=2.27.1",
|
||||
"colorgram.py>=1.2.0",
|
||||
"tqdm>=4.65.0",
|
||||
"rapidfuzz>=2.13.7",
|
||||
"tinytag>=2.0.0",
|
||||
"Unidecode>=1.3.6",
|
||||
"psutil>=5.9.4",
|
||||
"show-in-file-manager>=1.1.4",
|
||||
"flask-compress>=1.13",
|
||||
"tabulate>=0.9.0",
|
||||
"setproctitle>=1.3.2",
|
||||
"locust>=2.20.1",
|
||||
"waitress>=2.1.2",
|
||||
"watchdog>=4.0.0",
|
||||
"pendulum>=3.0.0",
|
||||
"flask-jwt-extended>=4.6.0",
|
||||
"sqlalchemy>=2.0.31",
|
||||
"memory-profiler>=0.61.0",
|
||||
"sortedcontainers>=2.4.0",
|
||||
"xxhash>=3.4.1",
|
||||
"ffmpeg-python>=0.2.0",
|
||||
"schedule>=1.2.2",
|
||||
"flask-openapi3>=4.0.3",
|
||||
"pillow>=11.1.0",
|
||||
]
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pylint = "^2.15.5"
|
||||
pytest = "^7.1.3"
|
||||
hypothesis = "^6.56.3"
|
||||
|
||||
[tool.poetry.dev-dependencies.black]
|
||||
version = "^22.6.0"
|
||||
allow-prereleases = true
|
||||
|
||||
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pyinstaller = "^5.9.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[pytest]
|
||||
console_output_style = "classic"
|
||||
testpaths = "tests"
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pyinstaller>=6.11.1",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user