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

Add support for setting binding address #708

Merged
merged 12 commits into from
Jan 1, 2025

Conversation

Cycloctane
Copy link
Member

@Cycloctane Cycloctane commented Dec 31, 2024

What do these changes do?

Add a new option --bind to set the binding address. Keep --host parameter to be used for overriding bind address when referencing static files.

Are there changes in behavior for the user?

  • runserver and serve now only listen to localhost by default.
  • host parameter now is infered from bind address.

Related issue number

Fixes #449

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

Copy link

codecov bot commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.85%. Comparing base (649b2c8) to head (9852b63).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #708       /-   ##
==========================================
  Coverage   95.78%   95.85%    0.06%     
==========================================
  Files          23       23              
  Lines        1686     1712       26     
  Branches      194      198        4     
==========================================
  Hits         1615     1641       26     
  Misses         46       46              
  Partials       25       25              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Dreamsorcerer
Copy link
Member

Hmm, there's a weird test failure... Otherwise, looks good.

@Dreamsorcerer
Copy link
Member

Also, if you'd like to try and upgrade pytest, there is a workaround mentioned in this comment I've yet to try: pytest-dev/pytest-forked#67 (comment)

@Cycloctane
Copy link
Member Author

Cycloctane commented Jan 1, 2025

Hmm, there's a weird test failure... Otherwise, looks good.

This test failure seems to be a pytest internal error and happens on macos only. All tests work well on my machine and other linux ci action. I don't have a macos environment to debug it...

Maybe it is related to pytest-dev/pytest-forked#78. Traceback shows the same "Bad file descriptor" message when running action with coverage disabled.

- set bind address in test_start_runserver to 0.0.0.0
@Cycloctane
Copy link
Member Author

Cycloctane commented Jan 1, 2025

The test passed after setting bind address to 0.0.0.0. 19e89ad

Have no idea why binding to localhost in this test causes pytest internal error on macos.

@Dreamsorcerer Dreamsorcerer merged commit 462bce9 into aio-libs:master Jan 1, 2025
21 checks passed
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 this pull request may close these issues.

runserver doesn't respect host setting
2 participants