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

Allow more Flask entrypoints #733

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

javierdelapuente
Copy link
Contributor

@javierdelapuente javierdelapuente commented Oct 15, 2024

  • Have you signed the CLA?

Currently for Flask the app global variables has to be in the file app.py in the base project directory.

This PR allows more possible places for entry points, following what is done in the FastAPI framework.

The app variable for the WSGI entrypoint will be searched in:

  1. app.py file in the base directory
  2. main.py file in the base directory
  3. In any of the following directories, the extension will look for the variable in the files __init__.py, app.py or main.py:
    a. app directory.
    b. src directory.
    c. A directory with the same name as the project.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 15, 2024
@javierdelapuente javierdelapuente marked this pull request as ready for review October 16, 2024 11:03
@linostar linostar self-requested a review November 11, 2024 09:31
Copy link
Contributor

@linostar linostar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add integration tests for the following use cases:

  • app variable inside one of the allowed entrypoint files other than the default app.py
  • same as above but the file that has the app variable is excluded in prime list

{"src": "flask/app/src", "migrate.sh": "flask/app/migrate.sh"},
"/bin/python3 -m gunicorn -c /flask/gunicorn.conf.py src.app:app",
id="Include other files beside the entrypoint",
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add unit tests for the other use-cases like src/main.py, src/__init__.py, foo_bar/main.py and foo_bar/__init__.py?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants