Deploying Django under a sub-path

190 views
Skip to first unread message

Arthur Pemberton

unread,
Jun 16, 2023, 5:02:08 PM6/16/23
to django-d...@googlegroups.com
The docs reference `FORCE_SCRIPT_NAME` but say very little of how to use it.

Reading through the code, I see very little use of `SCRIPT_NAME` itself, however as far as I can tell, use of `SCRIPT_NAME` is supposed to be how one deploys Django at a sub-path.

I had to modify wsgi.py per https://ruddra.com/deploy-django-subpath-openshift/ to get things to work.

Shouldn't this be a complete feature? 

I've re-checked https://docs.djangoproject.com/en/4.2/howto/deployment/ and there's no information on the topic (that I could find).

Arthur Pemberton

Arthur Pemberton

unread,
Jun 16, 2023, 5:19:24 PM6/16/23
to django-d...@googlegroups.com
Even with  `FORCE_SCRIPT_NAME` `MEDIA_URL` is being prefixed properly, but not `STATIC_URL` .

Was `FORCE_SCRIPT_NAME` just not meant to be used with the `runserver` ?

Arthur Pemberton

Arthur Pemberton

unread,
Jun 16, 2023, 5:24:19 PM6/16/23
to django-d...@googlegroups.com
I found https://code.djangoproject.com/ticket/7930 seems like  `FORCE_SCRIPT_NAME` just isn't meant to work.

Maybe the docs should reflect that.

Arthur Pemberton

Adam Johnson

unread,
Jun 23, 2023, 3:07:37 PM6/23/23
to django-d...@googlegroups.com
Hi Arthur,

You've found the wrong mailing list for this thread. This mailing list is for discussing the development of Django itself, not for support using Django. I guess that's why no one replied.

If you would like to suggest a documentation change please do open a PR with reference to the information you found.

Thanks,

Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CA%2BX4dQSQDcaApgWFmEE8MRERKbdHBBPh4KXa12pTi9FHO7zx1g%40mail.gmail.com.

Arthur Pemberton

unread,
Jun 23, 2023, 5:24:25 PM6/23/23
to django-d...@googlegroups.com
I actually meant this as a developer question: as, at least in my review of the code, and testing with `manage.py runserver`. use of `SCRIPT_NAME` has no observable effect. 

If that can be confirmed, then yes, the documentation should be updated, and I can do a PR accordingly. Use of `SCRIPT_NAME` itself is not documented anywhere; seems like it should at least be mentioned in the Deployment section.

Arthur Pemberton

Reply all
Reply to author
Forward
0 new messages