-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal_dev.py
More file actions
38 lines (28 loc) · 1.34 KB
/
local_dev.py
File metadata and controls
38 lines (28 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Run the submit-ce UI against real GCS for local development.
Uses bucket `arxiv-submit-dev` in project `arxiv-development`, with a
per-developer prefix derived from `$USER` so developers don't collide.
Run as:
uv run python local_dev.py
Requires `gcloud auth application-default login` (or equivalent ADC setup).
"""
import getpass
import os
# This can make the development log easier to read, by
# removing log messages for GET /static/*
import logging
logging.getLogger("werkzeug").setLevel(logging.WARNING)
DEV_NAME = None # if you want to override your netid.
os.environ.setdefault('STORE', 'gs')
os.environ.setdefault('STORE_GS_BUCKET', 'arxiv-submit-dev')
os.environ.setdefault('STORE_GS_PREFIX', DEV_NAME or getpass.getuser())
os.environ.setdefault('GCLOUD_PROJECT', 'arxiv-development')
os.environ.setdefault('TEMPLATES_AUTO_RELOAD', '1')
#os.environ.setdefault('COMPILE_API_URL', 'http://localhost:9001')
os.environ.setdefault('COMPILE_API_IMPERSONATE_SA', 'submit-ce-dev-sa@arxiv-development.iam.gserviceaccount.com')
from submit_ce.ui.factory import create_web_app
if __name__ == '__main__':
user_prefix = os.environ['STORE_GS_PREFIX']
print(f"INFO: Using GCS bucket gs://arxiv-submit-dev/{user_prefix}/")
print(f"INFO: GCP project: {os.environ['GCLOUD_PROJECT']}")
app = create_web_app()
app.run(debug=True, port=8000)