From 47f059dec78c6660dc8bcf2bc92da319d7052703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonhomme?= Date: Mon, 11 Mar 2024 11:12:19 +0100 Subject: [PATCH] chg: [core] Renamed runserver.py to app.py. --- Dockerfile | 4 +--- Makefile | 2 +- Procfile | 2 +- app.json | 1 - runserver.py => app.py | 0 contrib/update.sh | 2 -- contrib/webserver.wsgi.example | 2 +- docker-compose.yml | 2 -- docs/installation.rst | 12 +++++------- entrypoint.sh | 2 +- mosp/bootstrap.py | 2 +- 11 files changed, 11 insertions(+), 20 deletions(-) rename runserver.py => app.py (100%) diff --git a/Dockerfile b/Dockerfile index a8382d06..f8ea7b54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,15 +32,13 @@ COPY --from=node_modules /opt/node_modules/ mosp/static/npm_components/ RUN pybabel compile -d mosp/translations -COPY runserver.py . +COPY app.py . COPY entrypoint.sh . ENV MOSP_VERSION=latest ENV HOST=0.0.0.0 ENV PORT=5000 -ENV DEBUG=0 -ENV FLASK_APP=runserver.py ENV MOSP_CONFIG=docker.py VOLUME [ "/app/var" ] diff --git a/Makefile b/Makefile index 351ddbbd..221b5a19 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ activate: poetry shell run: - python runserver.py + flask run --debug migrate: flask db upgrade diff --git a/Procfile b/Procfile index 533f45e7..63d82622 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -web: pybabel compile -d mosp/translations; python runserver.py +web: pybabel compile -d mosp/translations; python app.py init: flask db_init diff --git a/app.json b/app.json index 53ba6895..a92d8c0b 100644 --- a/app.json +++ b/app.json @@ -24,7 +24,6 @@ ], "env": { "HEROKU": "1", - "FLASK_APP": "runserver.py", "ADMIN_EMAIL": "info@example.org", "ADMIN_URL": "https://www.example.org" } diff --git a/runserver.py b/app.py similarity index 100% rename from runserver.py rename to app.py diff --git a/contrib/update.sh b/contrib/update.sh index 83e1d243..cb9ee942 100755 --- a/contrib/update.sh +++ b/contrib/update.sh @@ -11,8 +11,6 @@ NC='\033[0m' # No Color set -e #set -x -export FLASK_APP=runserver.py - git pull origin master --tags npm ci poetry install --only main diff --git a/contrib/webserver.wsgi.example b/contrib/webserver.wsgi.example index 7b38263f..7701ce9c 100644 --- a/contrib/webserver.wsgi.example +++ b/contrib/webserver.wsgi.example @@ -7,7 +7,7 @@ activate_this = python_home + '/bin/activate_this.py' with open(activate_this) as file_: exec(file_.read(), dict(__file__=activate_this)) -from runserver import application +from app import application __all__ = [ "application" diff --git a/docker-compose.yml b/docker-compose.yml index d898e8a4..2b715b24 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,8 +19,6 @@ services: working_dir: /mosp tty: true environment: - - FLASK_APP=runserver.py - - FLASK_DEBUG=0 - MOSP_CONFIG=docker.py - HOST=0.0.0.0 - PORT=5000 diff --git a/docs/installation.rst b/docs/installation.rst index d658d4da..e3fd7c57 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -54,21 +54,19 @@ Get the source code and install the software: $ poetry install --only main $ poetry shell $ pybabel compile -d mosp/translations - $ export FLASK_APP=runserver.py - $ export FLASK_DEBUG=1 $ export MOSP_CONFIG=production.py $ flask db_create $ flask db_init $ flask import_licenses_from_spdx $ flask create_admin --login --password - $ flask run - * Serving Flask app "runserver" (lazy loading) - * Environment: development + $ flask run --debug * Debug mode: on - * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) + WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on http://127.0.0.1:5000 + Press CTRL+C to quit * Restarting with stat * Debugger is active! - * Debugger PIN: 221-873-938 + * Debugger PIN: 834-369-202 For production you should use `Gunicorn `_ or ``mod_wsgi``. diff --git a/entrypoint.sh b/entrypoint.sh index afa8e629..965fd676 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,4 +29,4 @@ for try in 1 2 3 4 5 6; do [ "$try" = "6" ] && exit 1 done -gunicorn --chdir /app --workers 2 --bind 0.0.0.0:5000 runserver:application +gunicorn --chdir /app --workers 2 --bind 0.0.0.0:5000 app:application diff --git a/mosp/bootstrap.py b/mosp/bootstrap.py index 418d5734..525f3be5 100644 --- a/mosp/bootstrap.py +++ b/mosp/bootstrap.py @@ -27,7 +27,7 @@ def set_logging( if not modules: modules = ( "bootstrap", - "runserver", + "app", "web", ) handler: Union[logging.Handler, None] = None