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

Let nikola serve work together with non-root BASE_URL or SITE_URL. Fixes #3726 #3804

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

aknrdureegaesr
Copy link
Contributor

Pull Request Checklist

  • I’ve read the guidelines for contributing.
  • I updated AUTHORS.txt and CHANGES.txt (if the change is non-trivial) and documentation (if applicable).
  • I tested my changes.

Description

With the previous implementation, check out nikola-site, edit config.py to say something like SITE_URL = "https://getnikola.com/documentation" and build anew, then run nikola serve --browser . This breaks in several ways, which is exactly the point of #3726 .

Now apply this pull request to nikola, and do the same again: It works.

I have also added some tests. They let the nikola server functionality run in a different thread, opening up an HTTP port. The main thread sends HTTP requests to the server and checks whether the answers are as expected.

Doing so exposed an assumption of the server plugin: "When I'm running, I'm the only thing that matters, so when I'm done, I might as well shut down the entire application." I don't like that from an architectural point of view. To put application-level shutdown into the hands of one of several components feels wrong to me. Essentially, such a component is not testable.

I left it in there, but guarded: This now happens only if running on the main thread. My tests runs the functionality on a different thread, so then the guard sees to it that the whole application is not shut down. In the process, I found the plugin didn't even try to stop the internal HTTP server when shutdown was called. This is somewhat improved now, at least for the case when the HTTP server runs in a thread of its own.

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.

1 participant