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: ensure api/static directory is created by Git #3702

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

rolodato
Copy link
Member

@rolodato rolodato commented Apr 1, 2024

This prevents a warning starting the API if this directory does not exist:

    /Users/rolodato/Library/Caches/pypoetry/virtualenvs/flagsmith-api-Avcq7jRJ-py3.11/lib/python3.11/site-packages/whitenoise/base.py:115: UserWarning: No directory at: /Users/rolodato/source/flagsmith/flagsmith/api/static/
  warnings.warn(f"No directory at: {root}")

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Adds a .gitkeep file that is allow-listed in api/.gitignore to ensure the api/static directory exists when cloning this repository. This prevents a warning when starting up the API and the directory does not yet exist.

Before:

% make serve
poetry run gunicorn --bind 127.0.0.1:8000 app.wsgi --reload
[2024-04-01 11:02:45 -0300] [46225] [INFO] Starting gunicorn 20.1.0
[2024-04-01 11:02:45 -0300] [46225] [INFO] Listening at: http://127.0.0.1:8000 (46225)
[2024-04-01 11:02:45 -0300] [46225] [INFO] Using worker: sync
[2024-04-01 11:02:45 -0300] [46228] [INFO] Booting worker with pid: 46228
/Users/rolodato/Library/Caches/pypoetry/virtualenvs/flagsmith-api-Avcq7jRJ-py3.11/lib/python3.11/site-packages/whitenoise/base.py:115: UserWarning: No directory at: /Users/rolodato/source/flagsmith/flagsmith/api/static/
  warnings.warn(f"No directory at: {root}")

After:

% make serve
poetry run gunicorn --bind 127.0.0.1:8000 app.wsgi --reload
[2024-04-01 11:08:44 -0300] [46650] [INFO] Starting gunicorn 20.1.0
[2024-04-01 11:08:44 -0300] [46650] [INFO] Listening at: http://127.0.0.1:8000 (46650)
[2024-04-01 11:08:44 -0300] [46650] [INFO] Using worker: sync
[2024-04-01 11:08:44 -0300] [46653] [INFO] Booting worker with pid: 46653

How did you test this code?

Manually by cleaning all untracked files and directories in the repository, and checking that the api/static directory still exists:

% git clean -f -d -x
% file api/static
api/static: directory

This prevents a warning starting the API if this directory does not exist:

    /Users/rolodato/Library/Caches/pypoetry/virtualenvs/flagsmith-api-Avcq7jRJ-py3.11/lib/python3.11/site-packages/whitenoise/base.py:115: UserWarning: No directory at: /Users/rolodato/source/flagsmith/flagsmith/api/static/
  warnings.warn(f"No directory at: {root}")
Copy link

vercel bot commented Apr 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 1, 2024 2:19pm

Copy link

vercel bot commented Apr 1, 2024

Someone is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the api Issue related to the REST API label Apr 1, 2024
@rolodato rolodato requested a review from matthewelwell April 2, 2024 18:11
@rolodato rolodato added this pull request to the merge queue Apr 2, 2024
Merged via the queue into Flagsmith:main with commit eca05ca Apr 2, 2024
20 of 22 checks passed
@rolodato rolodato deleted the fix-api-static-dir-warning branch April 2, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants