Cleaned up the web folder to make two separate 'apps'-webclient and website, each with their own static and template dirs. Also merged the prosimii template files into the website template folder. This will make it clearer how to override, since the static/template_override dirs will now look like website/static/... etc rather than using the template names, of which we only ever have used one anyway.

This commit is contained in:
Griatch 2016-01-23 21:56:07 +01:00
parent 5ea9d100d9
commit 4fd06b8976
23 changed files with 91 additions and 100 deletions

58
evennia/web/urls.py Executable file → Normal file
View file

@ -6,63 +6,19 @@
# http://diveintopython.org/regular_expressions/street_addresses.html#re.matching.2.3
#
from django.conf import settings
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import RedirectView
## fix to resolve lazy-loading bug
## https://code.djangoproject.com/ticket/10405#comment:11
#from django.db.models.loading import cache as model_cache
#if not model_cache.loaded:
# model_cache.get_models()
# loop over all settings.INSTALLED_APPS and execute code in
# files named admin.py in each such app (this will add those
# models to the admin site)
admin.autodiscover()
# Setup the root url tree from /
urlpatterns = [
# User Authentication
url(r'^accounts/login', 'django.contrib.auth.views.login', name="login"),
url(r'^accounts/logout', 'django.contrib.auth.views.logout', name="logout"),
# Front page (note that we shouldn't specify namespace here since we will
# not be able to load django-auth/admin stuff (will probably work in Django>1.9)
url(r'^', include('evennia.web.website.urls')),#, namespace='website', app_name='website')),
# Page place-holder for things that aren't implemented yet.
url(r'^tbi/', 'evennia.web.views.to_be_implemented', name='to_be_implemented'),
# Admin interface
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# favicon
url(r'^favicon\.ico$', RedirectView.as_view(url='/media/images/favicon.ico', permanent=False)),
# ajax stuff
# webclient
url(r'^webclient/', include('evennia.web.webclient.urls', namespace='webclient', app_name='webclient')),
# Front page
url(r'^$', 'evennia.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/', 'evennia.web.views.admin_wrapper', name="django_admin")]
if settings.EVENNIA_ADMIN:
urlpatterns += [
# Our override for the admin.
url('^admin/$', 'evennia.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).
if settings.SERVE_MEDIA:
urlpatterns.extend([
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT})
])
# favicon
url(r'^favicon\.ico$', RedirectView.as_view(url='/media/images/favicon.ico', permanent=False))
]

View file

@ -1,7 +0,0 @@
#
# Define database entities for the app.
#
from django.db import models

View file

@ -0,0 +1 @@
# The Evennia default website.

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before After
Before After

View file

@ -9,12 +9,12 @@
<meta name="generator" content="haran" />
{% if sidebar %}
<link rel="stylesheet" type="text/css" href="{% static "evennia_general/css/prosimii-screen-alt.css" %}" media="screen" title="Prosimii (Sidebar)" />
<link rel="stylesheet" type="text/css" href="{% static "website/css/prosimii-screen-alt.css" %}" media="screen" title="Prosimii (Sidebar)" />
{% else %}
<link rel="stylesheet" type="text/css" href="{% static "evennia_general/css/prosimii-screen.css" %}" media="screen" title="Prosimii" />
<link rel="stylesheet" type="text/css" href="{% static "website/css/prosimii-screen.css" %}" media="screen" title="Prosimii" />
{% endif %}
<link rel="stylesheet alternative" type="text/css" href="{% static "evennia_general/css/prosimii-print.css" %}" media="screen" title="Print Preview" />
<link rel="stylesheet" type="text/css" href="{% static "evennia_general/css/prosimii-print.css" %}" media="print" />
<link rel="stylesheet alternative" type="text/css" href="{% static "website/css/prosimii-print.css" %}" media="screen" title="Print Preview" />
<link rel="stylesheet" type="text/css" href="{% static "website/css/prosimii-print.css" %}" media="print" />
{% block header_ext %}
{% endblock %}
@ -35,7 +35,7 @@
</div>
<div class="midHeader">
<img src="{% static "evennia_general/images/evennia_logo.png" %}" align='left'/> <h1 class="headerTitle" lang="la">{{game_name}}</h1>
<img src="{% static "website/images/evennia_logo.png" %}" align='left'/> <h1 class="headerTitle" lang="la">{{game_name}}</h1>
<div class="headerSubTitle" title="Slogan">
<!-- Insert a slogan here if you want -->
{{game_slogan}} &nbsp;
@ -66,7 +66,7 @@
{% if webclient_enabled %}
| <a href="{% url 'webclient:index' %}">Play Online</a>
{% endif %}
</div>
</div>
@ -83,10 +83,10 @@
<div id="footer">
<span class="doNotPrint">
Template design by
Template design by
<a href="http://www.oswd.org/designs/search/designer/id/3013/"
title="Other designs by haran">haran</a>.
Powered by
title="Other designs by haran">haran</a>.
Powered by
<a href="http://evennia.com">Evennia.</a>
<br />
</span>

View file

@ -0,0 +1,47 @@
"""
This structures the website.
"""
from django.conf import settings
from django.contrib import admin
from django.conf.urls import url, include
# loop over all settings.INSTALLED_APPS and execute code in
# files named admin.py in each such app (this will add those
# models to the admin site)
admin.autodiscover()
urlpatterns = [
url(r'^$', 'evennia.web.website.views.page_index', name="index"),
url(r'^tbi/', 'evennia.web.website.views.to_be_implemented', name='to_be_implemented'),
# User Authentication
url(r'^accounts/login', 'django.contrib.auth.views.login', name="login"),
url(r'^accounts/logout', 'django.contrib.auth.views.logout', name="logout"),
# 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/', 'evennia.web.website.views.admin_wrapper', name="django_admin"),
# Admin docs
url(r'^admin/doc/', include('django.contrib.admindocs.urls'))
]
if settings.EVENNIA_ADMIN:
urlpatterns += [
# Our override for the admin.
url('^admin/$', 'evennia.web.website.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).
if settings.SERVE_MEDIA:
urlpatterns.extend([
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT})
])

View file

@ -53,7 +53,7 @@ def page_index(request):
"num_others": nothers or "no"
}
return render(request, 'evennia_general/index.html', pagevars)
return render(request, 'website/index.html', pagevars)
def to_be_implemented(request):
@ -66,7 +66,7 @@ def to_be_implemented(request):
"page_title": "To Be Implemented...",
}
return render(request, 'evennia_general/tbi.html', pagevars)
return render(request, 'website/tbi.html', pagevars)
@staff_member_required
@ -75,7 +75,7 @@ def evennia_admin(request):
Helpful Evennia-specific admin page.
"""
return render(
request, 'evennia_general/evennia_admin.html', {
request, 'website/evennia_admin.html', {
'playerdb': PlayerDB})