We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Deploy to the Internet

We're so close! We have one last step: to publish our site to the world wide web. (Yes, on a public domain and server)

GitHub Pages

GitHub Pages is a free service from GitHub that allows you to host static websites directly from a GitHub repository. Conveniently, you now have a static site generator!

That said, there are two limitations we're going to need to work around:

  1. GitHub pages serves repo sites from https://USERNAME.github.io/REPO_NAME/, which means that the "root" of our site will actually be at a subdirectory. We'll have to enhance our generator to handle that.
  2. GitHub Pages needs the code committed to Git (at least by default) to deploy the site. So we'll have to break our "don't commit the generated site" rule.

Make sure your repo is public, or you'll need a paid plan to use GitHub pages!

Assignment

    • The script is simple: python3 src/main.py "/REPO_NAME/" (replace REPO_NAME with your actual GitHub repo name)
    • Your main.py is also used for local testing, so it will still need the default / baseurl
    • Run the new build script and ensure that the site is built correctly
    • Set the source to the main branch and the docs directory.
    • Save the settings.
    • (Now the /docs directory on your main branch will auto deploy to your GitHub Pages URL once something is in it.)

Configure the Boot.dev CLI to use your new GitHub Pages URL for the tests:

bootdev config base_url https://USERNAME.github.io/REPO_NAME/

Run and submit the CLI tests from the root of the project.

You can then reset the base URL: bootdev config base_url --reset