Forbid /media and /static file browsing. Resolve #1746.

This commit is contained in:
Griatch 2019-08-28 20:07:03 +02:00
parent 3af404960e
commit 0201208ec9
2 changed files with 15 additions and 4 deletions

View file

@ -546,7 +546,7 @@ if WEBSERVER_ENABLED:
# Start a django-compatible webserver.
from evennia.server.webserver import DjangoWebRoot, WSGIWebServer, Website, LockableThreadPool
from evennia.server.webserver import DjangoWebRoot, WSGIWebServer, Website, LockableThreadPool, PrivateStaticRoot
# start a thread pool and define the root url (/) as a wsgi resource
# recognized by Django
@ -555,9 +555,9 @@ if WEBSERVER_ENABLED:
web_root = DjangoWebRoot(threads)
# point our media resources to url /media
web_root.putChild(b"media", static.File(settings.MEDIA_ROOT))
web_root.putChild(b"media", PrivateStaticRoot(settings.MEDIA_ROOT))
# point our static resources to url /static
web_root.putChild(b"static", static.File(settings.STATIC_ROOT))
web_root.putChild(b"static", PrivateStaticRoot(settings.STATIC_ROOT))
EVENNIA.web_root = web_root
if WEB_PLUGINS_MODULE: