Related to an effort to deploy the Django application to an /api path on a shared domain.
Description
This work is still WIP and the PR exists mostly to demonstrate the current difficulties. All of the troublesome parts (the circular imports) can be avoided if we switch to Caddy instead of Nginx and just re-write the path before forwarding it to the Django service. See the commit descriptions for more details on the issues.
Testing Instructions
Add a PATH_PREFIX variable to your api/.env file. I used PATH_PREFIX=totally_bogus_dude. Then navigate to http://localhost:50280/ and confirm that nothing appears unless you to go http://localhost:50280/totally_bogus_dude/ or whatever you set the PATH_PREFIX to.
Note that right now the app won't start due to a circular import that I'm not sure how to resolve (and which can be avoided if we use Caddy instead, because we could bypass fixing the not-technically-safe ignoring of reverse in building URLs).
Checklist
[ ] My pull request has a descriptive title (not a vague title like
Update index.md).
[ ] My pull request targets the default branch of the repository (main) or
a parent feature branch.
[ ] My commit messages follow [best practices][best_practices].
[ ] My code follows the established code style of the repository.
[ ] I added or updated tests for the changes I made (if applicable).
[ ] I added or updated documentation (if applicable).
[ ] I tried running the project locally and verified that there are no visible
errors.
Developer Certificate of Origin
```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```
Fixes
Related to an effort to deploy the Django application to an
/api
path on a shared domain.Description
This work is still WIP and the PR exists mostly to demonstrate the current difficulties. All of the troublesome parts (the circular imports) can be avoided if we switch to Caddy instead of Nginx and just re-write the path before forwarding it to the Django service. See the commit descriptions for more details on the issues.
Testing Instructions
Add a
PATH_PREFIX
variable to yourapi/.env
file. I usedPATH_PREFIX=totally_bogus_dude
. Then navigate tohttp://localhost:50280/
and confirm that nothing appears unless you to gohttp://localhost:50280/totally_bogus_dude/
or whatever you set the PATH_PREFIX to.Note that right now the app won't start due to a circular import that I'm not sure how to resolve (and which can be avoided if we use Caddy instead, because we could bypass fixing the not-technically-safe ignoring of
reverse
in building URLs).Checklist
Update index.md
).main
) or a parent feature branch.[best_practices]: https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project#_commit_guidelines
Developer Certificate of Origin
Developer Certificate of Origin
``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ```