diff --git a/.gitignore b/.gitignore
index c472b02630..413011b83d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,7 @@ __pycache__
# Installation-specific
game/settings.py
game/logs/*.log.*
+game/gamesrc/web/static/*
# Installer logs
pip-log.txt
diff --git a/src/settings_default.py b/src/settings_default.py
index bc1e31d2c0..d819a3b8cd 100644
--- a/src/settings_default.py
+++ b/src/settings_default.py
@@ -85,6 +85,15 @@ SSL_ENABLED = False
SSL_PORTS = [4001]
# Interface addresses to listen to. If 0.0.0.0, listen to all. Use :: for IPv6.
SSL_INTERFACES = ['0.0.0.0']
+# Activate Websocket support
+WEBSOCKET_ENABLED = False
+# Ports to use for Websockets
+WEBSOCKET_PORTS = [8021]
+# Interface addresses to listen to. If 0.0.0.0, listen to all. Use :: for IPv6.
+WEBSOCKET_INTERFACES = ['0.0.0.0']
+# This determine's whether Evennia's custom admin page is used, or if the
+# standard Django admin is used.
+EVENNIA_ADMIN = True
# The path that contains this settings.py file (no trailing slash).
BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Path to the src directory containing the bulk of the codebase's code.
diff --git a/src/web/templates/admin/base_site.html b/src/web/templates/admin/base_site.html
deleted file mode 100644
index 0fd56d237a..0000000000
--- a/src/web/templates/admin/base_site.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "admin/base.html" %}
-{% load i18n %}
-
-{% block title %}{{ title }} | {% trans 'Evennia site admin' %}{% endblock %}
-
-{% block branding %}
-
{% trans 'Evennia database administration' %}
- (Back)
-
-{% if app_list %}
-
- {% for app in app_list %}
-
- {% if app.name in evennia_userapps %}
-
- {% if app.name == 'Players' %}
-
Admin
-
Players are the out-of-character representation of a
- game account. A Player can potentially control any number of
- in-game character Objects (depending on game).
If you are an advanced user who needs access to the raw Django Admin, it is available here.
+ You can make this the default my changing EVENNIA_ADMIN to False in settings.py and reload.
+{% endblock content %}
\ No newline at end of file
diff --git a/src/web/urls.py b/src/web/urls.py
index 788be59bb3..ceb24fa423 100755
--- a/src/web/urls.py
+++ b/src/web/urls.py
@@ -37,7 +37,6 @@ urlpatterns = [
# Admin interface
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
- url(r'^admin/', include(admin.site.urls)),
# favicon
url(r'^favicon\.ico$', RedirectView.as_view(url='/media/images/favicon.ico')),
@@ -46,7 +45,22 @@ urlpatterns = [
url(r'^webclient/', include('src.web.webclient.urls', namespace='webclient', app_name='webclient')),
# Front page
- url(r'^$', 'src.web.views.page_index', name="index")]
+ url(r'^$', 'src.web.views.page_index', name="index"),
+
+ # Django original admin page. Make this URL is always available, whether
+ # we've chosen to use Evennia's custom admin or not.
+ url(r'django_admin/', 'src.web.views.admin_wrapper', name="django_admin")]
+
+if settings.EVENNIA_ADMIN:
+ urlpatterns += [
+ # Our override for the admin.
+ url('^admin/$', 'src.web.views.evennia_admin', name="evennia_admin"),
+
+ # Makes sure that other admin pages get loaded.
+ url(r'^admin/', include(admin.site.urls))]
+else:
+ # Just include the normal Django admin.
+ urlpatterns += [url(r'^admin/', include(admin.site.urls))]
# This sets up the server if the user want to run the Django
# test server (this should normally not be needed).
diff --git a/src/web/views.py b/src/web/views.py
index 2126a74c55..986ec141d8 100644
--- a/src/web/views.py
+++ b/src/web/views.py
@@ -5,18 +5,18 @@ the other applications. Views are django's way of processing e.g. html
templates on the fly.
"""
-from django.shortcuts import render_to_response
-from django.template import RequestContext
-#from django.contrib.auth.models import User
+from django.contrib.admin.sites import site
from django.conf import settings
+from django.contrib.admin.views.decorators import staff_member_required
+from django.shortcuts import render
from src.objects.models import ObjectDB
-#from src.typeclasses.models import TypedObject
from src.players.models import PlayerDB
from src.web.news.models import NewsEntry
_BASE_CHAR_TYPECLASS = settings.BASE_CHARACTER_TYPECLASS
+
def page_index(request):
"""
Main root page.
@@ -56,8 +56,8 @@ def page_index(request):
"num_others": nothers or "no"
}
- context_instance = RequestContext(request)
- return render_to_response('index.html', pagevars, context_instance)
+ return render(request, 'index.html', pagevars)
+
def to_be_implemented(request):
"""
@@ -69,7 +69,21 @@ def to_be_implemented(request):
"page_title": "To Be Implemented...",
}
- context_instance = RequestContext(request)
- return render_to_response('tbi.html', pagevars, context_instance)
+ return render(request, 'tbi.html', pagevars)
+@staff_member_required
+def evennia_admin(request):
+ """
+ Helpful Evennia-specific admin page.
+ """
+ return render(
+ request, 'evennia_admin.html', {
+ 'playerdb': PlayerDB})
+
+
+def admin_wrapper(request):
+ """
+ Wrapper that allows us to properly use the base Django admin site, if needed.
+ """
+ return staff_member_required(site.index)(request)
\ No newline at end of file