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

[Feature Request] Add configuration option to allow subpath for the webserver #5

Open
allangood opened this issue Mar 10, 2021 · 6 comments

Comments

@allangood
Copy link

First of all, thank you for your great work!

I am working in a way to add a configuration option (--webpath) to allow the web interface to be hosted in a subpath, like "/sendria".
This is particular important for me as I would like to run it behind a reverse proxy with multiple other projects.

I am opening this request for a future PR.

Thank you.

@msztolcman
Copy link
Owner

Hello @allangood

Thank you for your proposal! It may take some time, however I think it's worth to add. I'll try to start working on it in a while.

@sbusch
Copy link

sbusch commented Apr 22, 2021

I have the same requirement. Looking forward to your PR :-)

@msztolcman
Copy link
Owner

Hi guys,
I've already started work on it. I've already finished with hardest (from my point of view) part, I mean frontend ;) And now need to find some time for backend and polishing. Hope will find and finish soon.

@msztolcman
Copy link
Owner

msztolcman commented May 6, 2021

Hi @sbusch, @allangood ,

I just pushed some initial, but mostly working version of sendria, which can work in subpath. You can install it using pip:

pip install git+https://github.com/msztolcman/sendria.git@non-root-ui-sendria

It requires new param when starting sendria, i.e.:
--http-url-prefix /asd/

And slighlty modified nginx config (rewrite pragma), you can see whole config in https://github.com/msztolcman/sendria/blob/non-root-ui-sendria/addons/nginx-non-root.conf

Can you take a look is this working fine or not? I will try to test it more in few days, however other pair of eyes would be very useful :)

@allangood
Copy link
Author

Hello @msztolcman ,

Thank you for your update!

I've tried to build but couldn't build the assets:

/home/sendria/.local/bin/webassets -m sendria.build_assets build
Traceback (most recent call last):
  File "/home/sendria/.local/bin/webassets", line 8, in <module>
    sys.exit(run())
  File "/home/sendria/.local/lib/python3.9/site-packages/webassets/script.py", line 578, in run
    sys.exit(main(sys.argv[1:]) or 0)
  File "/home/sendria/.local/lib/python3.9/site-packages/webassets/script.py", line 572, in main
    return GenericArgparseImplementation(env).main(argv)
  File "/home/sendria/.local/lib/python3.9/site-packages/webassets/script.py", line 557, in main
    return self.run_with_argv(argv)
  File "/home/sendria/.local/lib/python3.9/site-packages/webassets/script.py", line 549, in run_with_argv
    return self.run_with_ns(ns)
  File "/home/sendria/.local/lib/python3.9/site-packages/webassets/script.py", line 531, in run_with_ns
    env = self._setup_assets_env(ns, log)
  File "/home/sendria/.local/lib/python3.9/site-packages/webassets/script.py", line 509, in _setup_assets_env
    env = PythonLoader(ns.module).load_environment()
  File "/home/sendria/.local/lib/python3.9/site-packages/webassets/loaders.py", line 272, in __init__
    self.module = import_module(module_name)
  File "/home/sendria/.local/lib/python3.9/site-packages/webassets/importlib.py", line 36, in import_module
    __import__(name)
  File "/home/sendria/.local/lib/python3.9/site-packages/sendria/build_assets.py", line 4, in <module>
    environment = configure_assets(False, False)
  File "/home/sendria/.local/lib/python3.9/site-packages/sendria/http/core.py", line 272, in configure_assets
    assets = webassets.Environment(directory=config.STATIC_DIR, url=config.CONFIG.url_static)
AttributeError: 'NoneType' object has no attribute 'url_static'

Am I missing something?

@msztolcman
Copy link
Owner

Hi @allangood,

I missed some problems with running webassets manually. It's not related to this issue, will fix this later. Please run sendria with -a switch, then it should automatically create assets. This works fine on newly created vps. Also, I've updated nginx config, now it works with url's without trailing /.

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

No branches or pull requests

3 participants