Closed markkuriekkinen closed 2 years ago
There are useful comments in the source code: https://github.com/apluslms/a-plus/blob/2e84c737c03a28f8c09f4b51f1661e2b2456b5db/lib/remote_page.py#L298-L323
In the RST build, a-plus-rst-tools add the data-aplus-path
attribute here:
https://github.com/apluslms/a-plus-rst-tools/blob/5354ba6c0f5eedb6f000ef6f9f0109492d463fdb/lib/html_tools.py#L154-L167
The O1 course wants to build the RST course without the
static_host
setting in conf.py because they commit the built html to the course git repo. O1 doesn't want to usestatic_host
since in their case, its value should be different in local testing versus the production server. In order to make this work withoutstatic_host
, new URL manipulation in the A+ front is required (a-plus/lib/remote_page.py fix_relative_urls()
):A+ could set relative static URLs to some other domain/netloc than the original backend service (e.g., images in grader.cs assignment pointing to gitmanager.cs). It would probably be easy since it would be just a mapping from a domain to another. A+ would need to check the mappings for every relative URL in all loaded chapters and assignments, though.
O1 concerns in aplusguru: https://rt.cs.aalto.fi/Ticket/Display.html?id=20318
Background
With the new Git Manager in v1.12, the course static files are hosted in gitmanager.cs instead of grader.cs (MOOC-Grader). Images and static file URLs were broken inside assignment descriptions, i.e., the embedded exercise frame in an A+ chapter page, if RST courses were compiled without the
static_host
setting in conf.pyAplusguru tickets:
The image URLs pointed to grader.cs when they should point to gitmanager.cs. The domain grader.cs was taken from the exercise service URL (in
a-plus/lib/remote_page.py fix_relative_urls()
).a-plus-rst-tools compiles links relatively because that's how Sphinx works. The setting
static_host = os.environ.get('STATIC_CONTENT_HOST)
can be used to make static URLs absolute with the netloc/domain already in the course build.The new Git Manager automatically sets the build environment variable
STATIC_CONTENT_HOST="https://gitmanager.cs.aalto.fi/static/COURSEKEY"
EDIT Jira: https://jira.aalto.fi/browse/EDIT-795