minors
This commit is contained in:
parent
59640df3bc
commit
8216dd0d4e
|
@ -58,7 +58,8 @@ def login_required(func):
|
|||
async def wrap(parent, info: GraphQLResolveInfo, *args, **kwargs):
|
||||
# print('[auth.authenticate] login required for %r with info %r' % (func, info)) # debug only
|
||||
auth: AuthCredentials = info.context["request"].auth
|
||||
print('[auth.authenticate] request auth data: %r' % auth) # debug only
|
||||
if auth and auth.user_id:
|
||||
print(auth) # debug only
|
||||
if not auth.logged_in:
|
||||
return {"error": auth.error_message or "Please login"}
|
||||
return await func(parent, info, *args, **kwargs)
|
||||
|
|
25
server.py
25
server.py
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user