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

Serve site from a non-root path #246

Open
chrisparana opened this issue Apr 25, 2016 · 4 comments
Open

Serve site from a non-root path #246

chrisparana opened this issue Apr 25, 2016 · 4 comments

Comments

@chrisparana
Copy link

Is there a way to configure a site that will not be residing at the root path? All my URLs/static are broken because it's assumed that it starts at root.

@ghost
Copy link

ghost commented Apr 28, 2016

Just to clearify, you've setup a domain and the cactus page resides in a subdir like domain.tld/mycactus_site/ ?

Maybe the Site URL config feature is your friend then: Site URL.

@chrisparana
Copy link
Author

Yes, it's a work provided staff page, each user has their own domain.tld/username/ page… adding the url to Site URL in the config didn't seem to make a difference. For example static items urls all still start at /static/, which of course, won't work.

@ghost
Copy link

ghost commented Apr 30, 2016

You are right site-URL isn't of much use here. I guess trying "Page and static prefix support proposal" is your best bet atm.

@kamalx
Copy link

kamalx commented Feb 24, 2017

I was looking for a solution to this same problem and couldn't find anything yet. In that regard, the only thing that has worked for me is to use relative URLs for static resources.

Would I run into any potential problems down the line if I use src="static/images/myimage.png" instead of src="{% static 'images/myimage.png' %}" on a site hosted in a non-root dir?

I am also not using the {% url '' %} tags for links; I use relative links directly instead. I am not sure of the implications of that completely yet but it has worked perfectly for my relatively small website with a flat hierarchy pretty seamlessly. I can host the generated websites from any subdir I want without issues.

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

2 participants