Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix module name in running the app instructions in v3.rst #1948

Open
chrisinmtown opened this issue Jul 17, 2024 · 1 comment · May be fixed by #1993
Open

Fix module name in running the app instructions in v3.rst #1948

chrisinmtown opened this issue Jul 17, 2024 · 1 comment · May be fixed by #1993

Comments

@chrisinmtown
Copy link

chrisinmtown commented Jul 17, 2024

Description

I'm trying to migrate from v2 to v3, and started by reading https://connexion.readthedocs.io/en/latest/v3.html

The section "Running the application" shows a file named hello.py with this content:

import connexion

app = connexion.App(__name__)

if __name__ == "__main__":
    app.run()

Then instructs me to issue one of these commands to run the application:

$ uvicorn run:app
$ gunicorn -k uvicorn.workers.UvicornWorker run:app

I think these should read:

$ uvicorn hello:app
$ gunicorn -k uvicorn.workers.UvicornWorker hello:app

Expected behaviour

The app starts with the expected output:

% uvicorn hello:app
INFO:     Started server process [21732]
INFO:     Waiting for application startup.
INFO:     ASGI 'lifespan' protocol appears unsupported.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Actual behaviour

The module "run" is not found:

% uvicorn run:app
ERROR:    Error loading ASGI app. Could not import module "run"

Steps to reproduce

  • pip install connexion[flask]
  • create file hello.py with content shown above
  • issue command uvicorn run:app

Additional info:

% python --version
Python 3.11.9
% pip show connexion | grep "^Version\:"
Version: 2.14.2

Look, I realize this bug is trivial. Still the complexity of migrating this app is large, and when the very first step doesn't work, it is frustrating.

Thanks for listening.

@chrisinmtown
Copy link
Author

Here's the diff of the change I propose:

% git diff v3.rst
diff --git a/docs/v3.rst b/docs/v3.rst
index 260b9e1..9d34526 100644
--- a/docs/v3.rst
+++ b/docs/v3.rst
@@ -94,11 +94,11 @@ Instead, you need to run the Connexion application using an ASGI server:
 
 .. code-block:: bash
 
-    $ uvicorn run:app
+    $ uvicorn hello:app
 
 .. code-block:: bash
 
-    $ gunicorn -k uvicorn.workers.UvicornWorker run:app
+    $ gunicorn -k uvicorn.workers.UvicornWorker hello:app
 
 .. warning::

chrisinmtown added a commit to chrisinmtown/connexion that referenced this issue Nov 11, 2024
Add server url /openapi to JWT example
Drop outdated `convert_unicode` parameter in Sqlalchemy example
Correct name of module in v3 instructions

Fixes spec-first#1948, spec-first#1987
chrisinmtown added a commit to chrisinmtown/connexion that referenced this issue Nov 12, 2024
Add server url /openapi to JWT example
Drop outdated `convert_unicode` parameter in Sqlalchemy example
Correct name of module in v3 instructions

Fixes spec-first#1948, spec-first#1987
chrisinmtown added a commit to chrisinmtown/connexion that referenced this issue Nov 12, 2024
Add server url /openapi to JWT example
Add TODO to SQLAlchemy example, does not work with current versions
Correct name of module in v3 instructions

Fixes spec-first#1948, spec-first#1987
chrisinmtown added a commit to chrisinmtown/connexion that referenced this issue Nov 19, 2024
Add server url /openapi to JWT example
Add TODO to SQLAlchemy example, does not work with current versions
Correct name of module in v3 instructions

Fixes spec-first#1948, spec-first#1987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant