app-server
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: app_server | ||
| Version: 0.9.6 | ||
| Version: 0.9.8 | ||
| Summary: a lightweight web application launcher for gunicorn and static files. | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/XeoN-GHMB/app_server |
| Metadata-Version: 2.1 | ||
| Name: app-server | ||
| Version: 0.9.6 | ||
| Version: 0.9.8 | ||
| Summary: a lightweight web application launcher for gunicorn and static files. | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/XeoN-GHMB/app_server |
@@ -16,3 +16,3 @@ import sys, os, re, subprocess, yaml, argparse, time, mimetypes, logging | ||
| __version__ = "0.9.6" | ||
| __version__ = "0.9.8" | ||
@@ -235,3 +235,3 @@ subprocesses = [] | ||
| "target": f"{protocol}://{host}:{gunicorn_port}/", | ||
| "host": f"{host}:{port}" | ||
| "host": None | ||
| } | ||
@@ -244,4 +244,11 @@ },timeout=timeout)}) | ||
| def envVars(application_id, args): | ||
| """set nessesary environment variables""" | ||
| def envVars(application_id: str, args: argparse.Namespace, app_yaml: dict): | ||
| """set necessary environment variables""" | ||
| # First, merge the app.yaml into the environment so that the variables | ||
| # from the CLI can overwrite it. | ||
| if env_vars := app_yaml.get("env_variables"): | ||
| if not isinstance(env_vars, dict): | ||
| raise TypeError(f"env_variables section in app.yaml must be a dict. Got {type(env_vars)}") | ||
| os.environ |= {k: str(v) for k, v in app_yaml["env_variables"].items()} | ||
| os.environ["GAE_ENV"] = "localdev" | ||
@@ -259,2 +266,6 @@ os.environ["CLOUDSDK_CORE_PROJECT"] = application_id | ||
| # Merge environment variables from CLI parameter | ||
| if args.env_var: | ||
| os.environ |= dict(v.split("=", 1) for v in args.env_var) | ||
| def patch_gunicorn(): | ||
@@ -316,3 +327,3 @@ import gunicorn.workers.base | ||
| ap.add_argument('--threads', type=int, default=5, help='amount of gunicorn threads') | ||
| ap.add_argument('--timeout', type=int, default=60, help='Time is seconds befor gunicorn abort a rquest') | ||
| ap.add_argument('--timeout', type=int, default=60, help='Time is seconds before gunicorn abort a request') | ||
| ap.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__) | ||
@@ -328,6 +339,11 @@ | ||
| ap.add_argument( | ||
| '--env_var', metavar="KEY=VALUE", nargs="*", | ||
| help="Set environment variable for the runtime. Each env_var is in " | ||
| "the format of KEY=VALUE, and you can define multiple " | ||
| "environment variables. You can also define them in app.yaml." | ||
| ) | ||
| args = ap.parse_args() | ||
| envVars(args.app_id, args) | ||
| patch_gunicorn() | ||
| myFolder = os.getcwd() | ||
| appFolder = os.path.abspath(args.config_paths[0]) | ||
@@ -339,2 +355,6 @@ | ||
| envVars(args.app_id, args, appYaml) | ||
| patch_gunicorn() | ||
| myFolder = os.getcwd() | ||
| # Check for correct runtime | ||
@@ -341,0 +361,0 @@ myRuntime = f"python{sys.version_info.major}{sys.version_info.minor}" |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
265355
0.33%6046
0.25%