This commit is contained in:
2022-11-24 19:02:42 +03:00
parent 59640df3bc
commit 8216dd0d4e
2 changed files with 16 additions and 12 deletions

View File

@@ -48,6 +48,17 @@ log_settings = {
}
}
local_headers = [
("Access-Control-Allow-Methods", "GET, POST, OPTIONS, HEAD"),
("Access-Control-Allow-Origin", "http://localhost:3000"),
(
"Access-Control-Allow-Headers",
"DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization",
),
("Access-Control-Expose-Headers", "Content-Length,Content-Range"),
("Access-Control-Allow-Credentials", "true"),
]
if __name__ == "__main__":
x = ""
if len(sys.argv) > 1:
@@ -56,27 +67,18 @@ if __name__ == "__main__":
if os.path.exists(DEV_SERVER_STATUS_FILE_NAME):
os.remove(DEV_SERVER_STATUS_FILE_NAME)
headers = [
("Access-Control-Allow-Methods", "GET, POST, OPTIONS, HEAD"),
("Access-Control-Allow-Origin", "http://localhost:3000"),
(
"Access-Control-Allow-Headers",
"DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization",
),
("Access-Control-Expose-Headers", "Content-Length,Content-Range"),
("Access-Control-Allow-Credentials", "true"),
]
want_reload = False
if "reload" in sys.argv:
print("MODE: DEV + RELOAD")
want_reload = True
else:
print("MODE: DEV")
uvicorn.run(
"main:dev_app",
host="localhost",
port=8080,
headers=headers,
headers=local_headers,
# log_config=LOGGING_CONFIG,
log_level=None,
access_log=False,
@@ -84,6 +86,7 @@ if __name__ == "__main__":
) # , ssl_keyfile="discours.key", ssl_certfile="discours.crt")
elif x == "migrate":
from migration import migrate
print("MODE: MIGRATE")
migrate()
else: