amp_service = internet.TCPServer(AMP_PORT, factory, interface=AMP_INTERFACE) amp_service.setName("EvenniaPortal") EVENNIA.services.addService(amp_service) if WEBSERVER_ENABLED: # Start a django-compatible webserver. from twisted.python import threadpool from evennia.server.webserver import DjangoWebRoot, WSGIWebServer, Website # start a thread pool and define the root url (/) as a wsgi resource # recognized by Django threads = threadpool.ThreadPool(minthreads=max(1, settings.WEBSERVER_THREADPOOL_LIMITS[0]), maxthreads=max(1, settings.WEBSERVER_THREADPOOL_LIMITS[1])) web_root = DjangoWebRoot(threads) # point our media resources to url /media web_root.putChild("media", static.File(settings.MEDIA_ROOT)) # point our static resources to url /static web_root.putChild("static", static.File(settings.STATIC_ROOT)) if WEB_PLUGINS_MODULE: # custom overloads web_root = WEB_PLUGINS_MODULE.at_webserver_root_creation(web_root) web_site = Website(web_root, logPath=settings.HTTP_LOG_FILE) for proxyport, serverport in WEBSERVER_PORTS: # create the webserver (we only need the port for this) webserver = WSGIWebServer(threads, serverport, web_site, interface='127.0.0.1') webserver.setName('EvenniaWebServer%s' % serverport)
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 threads = LockableThreadPool( minthreads=max(1, settings.WEBSERVER_THREADPOOL_LIMITS[0]), maxthreads=max(1, settings.WEBSERVER_THREADPOOL_LIMITS[1]), ) web_root = DjangoWebRoot(threads) # point our media resources to url /media web_root.putChild(b"media", PrivateStaticRoot(settings.MEDIA_ROOT)) # point our static resources to url /static web_root.putChild(b"static", PrivateStaticRoot(settings.STATIC_ROOT)) EVENNIA.web_root = web_root if WEB_PLUGINS_MODULE: # custom overloads web_root = WEB_PLUGINS_MODULE.at_webserver_root_creation(web_root) web_site = Website(web_root, logPath=settings.HTTP_LOG_FILE) web_site.is_portal = False INFO_DICT["webserver"] = "" for proxyport, serverport in WEBSERVER_PORTS: