Skip to content

SubUrl (sub directory) - does it work? #900

Answered by cuu508
alexkoon asked this question in Q&A
Discussion options

You must be logged in to vote

Serving under a subpath is not well tested – it may be possible to get to work, but you may run into issues (PRs welcome). There is also no specific documentation to get it to work.

I just tested the following setup:

On my local system, I started a development web server with the following additional settings in local_settings.py:

FORCE_SCRIPT_NAME = "/foo"
STATIC_URL = "/foo/static/"
CSRF_TRUSTED_ORIGINS = ["http://localhost"]

It serves on http://localhost:8000.

On the same system I configured nginx like so:

user www-data;
worker_processes auto;
worker_cpu_affinity auto;
pid /run/nginx.pid;

events {
    worker_connections 4000;
    use epoll;
    accept_mutex off;
}

http {
    include …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alexkoon
Comment options

Answer selected by alexkoon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #898 on September 25, 2023 07:31.