Restructured web resources to better manage static files.

This commit is contained in:
Kelketek Rritaa 2014-05-02 22:52:12 -05:00
parent 05c9d67ffc
commit 16bcc3c9f0
25 changed files with 70 additions and 59 deletions

View file

@ -5,9 +5,8 @@ It is imported from the root handler, game.web.urls.py.
from django.conf.urls import *
urlpatterns = patterns('src.web.news.views',
(r'^show/(?P<entry_id>\d+)/$', 'show_news'),
(r'^archive/$', 'news_archive'),
(r'^search/$', 'search_form'),
(r'^search/results/$', 'search_results'),
)
urlpatterns = [
url(r'^show/(?P<entry_id>\d+)/$', 'show_news', name="show"),
url(r'^archive/$', 'news_archive', name="archive"),
url(r'^search/$', 'search_form', name="search"),
url(r'^search/results/$', 'search_results', name="search_results")]

View file

Before

Width:  |  Height:  |  Size: 678 KiB

After

Width:  |  Height:  |  Size: 678 KiB

Before After
Before After

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

@ -5,7 +5,7 @@
{% block branding %}
<h1 id="site-name">{% trans 'Evennia database administration' %}
<a href="/">(Back)</a> </h1>
<a href="{% url "index" %}">(Back)</a> </h1>
{% endblock %}
{% block nav-global %}{% endblock %}

View file

@ -1,3 +1,4 @@
{% load staticfiles %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@ -8,12 +9,12 @@
<meta name="generator" content="haran" />
{% if sidebar %}
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/prosimii-screen-alt.css" media="screen" title="Prosimii (Sidebar)" />
<link rel="stylesheet" type="text/css" href="{% static "ev/css/prosimii-screen-alt.css" %}" media="screen" title="Prosimii (Sidebar)" />
{% else %}
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/prosimii-screen.css" media="screen" title="Prosimii" />
<link rel="stylesheet" type="text/css" href="{% static "ev/css/prosimii-screen.css" %}" media="screen" title="Prosimii" />
{% endif %}
<link rel="stylesheet alternative" type="text/css" href="{{MEDIA_URL}}css/prosimii-print.css" media="screen" title="Print Preview" />
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/prosimii-print.css" media="print" />
<link rel="stylesheet alternative" type="text/css" href="{% static "ev/css/prosimii-print.css" %}" media="screen" title="Print Preview" />
<link rel="stylesheet" type="text/css" href="{% static "ev/css/prosimii-print.css" %}" media="print" />
{% block header_ext %}
{% endblock %}
@ -34,7 +35,7 @@
</div>
<div class="midHeader">
<img src="/media/images/evennia_logo_small.png" align='left'/> <h1 class="headerTitle" lang="la">{{game_name}}</h1>
<img src="{% static "ev/images/evennia_logo_small.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;
@ -45,13 +46,13 @@
<div class="headerLinks">
<span class="doNotDisplay">Tools:</span>
{% if user.is_authenticated %}
<a href="/accounts/logout/">Log Out &laquo;</a>
<a href="{% url 'logout' %}">Log Out &laquo;</a>
<span class="doNotDisplay">|</span>
Logged in as {{user.username}} &laquo;
{% else %}
<a href="/accounts/login/">Log In &laquo;</a>
<a href="{% url 'login' %}">Log In &laquo;</a>
<span class="doNotDisplay">|</span>
<a href="/tbi">Register &laquo;</a>
<a href="{% url 'to_be_implemented' %}">Register &laquo;</a>
{% endif %}
</div>
</div>
@ -61,9 +62,9 @@
<a href="/">Home</a> |
<a href="https://github.com/evennia/evennia/wiki/Evennia-Introduction/">About</a> |
<a href="https://github.com/evennia/evennia/wiki">Documentation</a> |
<a href="/admin/">Admin Interface</a>
<a href="{% url 'admin:index' %}">Admin Interface</a>
{% if webclient_enabled %}
| <a href="/webclient">Play Online</a>
| <a href="{% url 'webclient:index' %}">Play Online</a>
{% endif %}
</div>
@ -87,7 +88,7 @@
title="Other designs by haran">haran</a>.
Powered by
<a href="http://evennia.com">Evennia.</a>
<br \>
<br />
</span>
</div>
</body>

View file

@ -14,11 +14,11 @@
<p>Welcome to your new installation of <a href="http://evennia.com">Evennia</a>, your friendly
neighborhood next-generation MUD development system and server. You are looking at Evennia's web
presence, which can be expanded to a full-fledged site as
needed. Through the <a href="/admin">admin interface</a> you can view and edit the
needed. Through the <a href="{% url 'admin:index' %}">admin interface</a> you can view and edit the
database without logging into the game.
{% if webclient_enabled %}
You can also connect to the game directly from your browser using our
<a href='/webclient'>online client</a>!<br></br>
<a href="{% url 'webclient:index' %}">online client</a>!<br></br>
{% endif %}
For more info, take your time to
peruse our extensive online <a href="https://github.com/evennia/evennia/wiki">documentation</a>.

View file

@ -24,18 +24,16 @@ admin.autodiscover()
# Setup the root url tree from /
urlpatterns = patterns('',
urlpatterns = [
# User Authentication
url(r'^accounts/login', 'django.contrib.auth.views.login'),
url(r'^accounts/logout', 'django.contrib.auth.views.logout'),
url(r'^accounts/login', 'django.contrib.auth.views.login', name="login"),
url(r'^accounts/logout', 'django.contrib.auth.views.logout', name="logout"),
# Front page
url(r'^', include('src.web.website.urls')),
# News stuff
# url(r'^news/', include('src.web.news.urls')),
# Page place-holder for things that aren't implemented yet.
url(r'^tbi/', 'src.web.website.views.to_be_implemented'),
url(r'^tbi/', 'src.web.views.to_be_implemented', name='to_be_implemented'),
# Admin interface
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
@ -44,13 +42,16 @@ urlpatterns = patterns('',
# favicon
url(r'^favicon\.ico$', RedirectView.as_view(url='/media/images/favicon.ico')),
# webclient stuff
url(r'^webclient/', include('src.web.webclient.urls')),
)
# ajax stuff
url(r'^webclient/', include('src.web.webclient.urls', namespace='webclient', app_name='webclient')),
# Front page
url(r'^$', 'src.web.views.page_index', name="index")]
# 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 += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)
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

@ -33,7 +33,7 @@ def page_index(request):
nplyrs_conn_recent = len(recent_users) or "none"
nplyrs = PlayerDB.objects.num_total_players() or "none"
nplyrs_reg_recent = len(PlayerDB.objects.get_recently_created_players()) or "none"
nsess = len(PlayerDB.objects.get_connected_players()) or "none"
nsess = len(PlayerDB.objects.get_connected_players()) or "no one"
nobjs = ObjectDB.objects.all().count()
nrooms = ObjectDB.objects.filter(db_location__isnull=True).exclude(db_typeclass_path=_BASE_CHAR_TYPECLASS).count()

View file

@ -1,4 +1,5 @@
<!DOCTYPE html>
{% load staticfiles %}
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
@ -6,7 +7,7 @@
<title>Evennia web MUD client</title>
<!--CSS style sheet -->
<link rel='stylesheet' type="text/css" media="screen" href="/media/css/webclient.css">
<link rel='stylesheet' type="text/css" media="screen" href="{% static "webclient/css/webclient.css" %}">
<!-- Importing the online jQuery javascript library -->
<!--script src="http://code.jquery.com/jquery-1.6.1.js" type="text/javascript" charset="utf-8"></script-->
@ -23,14 +24,13 @@
document.write("\<script src=\"/media/javascript/evennia_websocket_webclient.js\" type=\"text/javascript\" charset=\"utf-8\"\>\</script\>")}
else {
<!-- No websocket support in browser. Importing the Evennia ajax webclient component (requires jQuery) -->
document.write("\<script src=\"/media/javascript/evennia_ajax_webclient.js\" type=\"text/javascript\" charset=\"utf-8\"\>\</script\>")}
document.write("\<script src=\"{% static "webclient/js/evennia_ajax_webclient.js" %}\" type=\"text/javascript\" charset=\"utf-8\"\>\</script\>")}
</script>
{% else %}
<!-- websocket not enabled; use ajax -->
<script src="/media/javascript/evennia_ajax_webclient.js" type="text/javascript" charset="utf-8"></script>
{% endif %}
</head>
<body>

View file

@ -4,5 +4,5 @@ webpage 'application'.
"""
from django.conf.urls import *
urlpatterns = patterns('',
url(r'^$', 'src.web.webclient.views.webclient'),)
urlpatterns = [
url(r'^$', 'src.web.webclient.views.webclient', name="index")]

View file

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

View file

@ -1,10 +0,0 @@
"""
This structures the (simple) structure of the
webpage 'application'.
"""
from django.conf.urls import *
urlpatterns = patterns('src.web.website.views',
(r'^$', 'page_index'),
)