mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Restructured web resources to better manage static files.
This commit is contained in:
parent
05c9d67ffc
commit
16bcc3c9f0
25 changed files with 70 additions and 59 deletions
5
game/gamesrc/web/static/README.md
Normal file
5
game/gamesrc/web/static/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
This folder is used by Django's staticfiles application for gathering all static files (CSS, JS, etc) into one place
|
||||
from the various sources that they might be gathered from.
|
||||
|
||||
Do not edit files in this directory. Instead, read up on Django's static file handling to learn how to create Django
|
||||
apps with their own static files.
|
||||
13
game/gamesrc/web/urls.py
Normal file
13
game/gamesrc/web/urls.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from src.web.urls import urlpatterns
|
||||
#
|
||||
# File that determines what each URL points to. This uses _Python_ regular
|
||||
# expressions, not Perl's.
|
||||
#
|
||||
# See:
|
||||
# http://diveintopython.org/regular_expressions/street_addresses.html#re.matching.2.3
|
||||
#
|
||||
|
||||
# You can add URLs to your game's website by extending urlpatterns.
|
||||
#
|
||||
# These are Django URL patterns, so you should look up how to use these at
|
||||
# https://docs.djangoproject.com/en/1.6/topics/http/urls/
|
||||
|
|
@ -18,6 +18,7 @@ found on http://localhost:8000/webclient.)
|
|||
"""
|
||||
import time
|
||||
import json
|
||||
|
||||
from hashlib import md5
|
||||
|
||||
from twisted.web import server, resource
|
||||
|
|
@ -32,7 +33,6 @@ from src.server import session
|
|||
SERVERNAME = settings.SERVERNAME
|
||||
ENCODINGS = settings.ENCODINGS
|
||||
|
||||
|
||||
# defining a simple json encoder for returning
|
||||
# django data to the client. Might need to
|
||||
# extend this if one wants to send more
|
||||
|
|
|
|||
|
|
@ -411,6 +411,8 @@ if WEBSERVER_ENABLED:
|
|||
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))
|
||||
web_site = server.Site(web_root, logPath=settings.HTTP_LOG_FILE)
|
||||
|
||||
for proxyport, serverport in WEBSERVER_PORTS:
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ LOCALE_PATHS = ["../locale/"]
|
|||
SERVE_MEDIA = False
|
||||
# The master urlconf file that contains all of the sub-branches to the
|
||||
# applications.
|
||||
ROOT_URLCONF = 'src.web.urls'
|
||||
ROOT_URLCONF = 'game.gamesrc.web.urls'
|
||||
# Where users are redirected after logging in via contrib.auth.login.
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
# Where to redirect users when using the @login_required decorator.
|
||||
|
|
@ -493,7 +493,13 @@ MEDIA_URL = '/media/'
|
|||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure
|
||||
# to use a trailing slash. Django1.4+ will look for admin files under
|
||||
# STATIC_URL/admin.
|
||||
STATIC_URL = '/media/'
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
STATIC_ROOT = os.path.join(GAME_DIR, "gamesrc", "web", "static")
|
||||
|
||||
# Folders from which static files will be gathered from.
|
||||
STATICFILES_DIRS = (
|
||||
os.path.join(SRC_DIR, "web", "static"),)
|
||||
# The name of the currently selected web template. This corresponds to the
|
||||
# directory names shown in the webtemplates directory.
|
||||
ACTIVE_TEMPLATE = 'prosimii'
|
||||
|
|
@ -540,6 +546,7 @@ INSTALLED_APPS = (
|
|||
'django.contrib.admin',
|
||||
'django.contrib.admindocs',
|
||||
'django.contrib.flatpages',
|
||||
'django.contrib.staticfiles',
|
||||
'src.server',
|
||||
'src.typeclasses',
|
||||
'src.players',
|
||||
|
|
@ -548,7 +555,7 @@ INSTALLED_APPS = (
|
|||
'src.help',
|
||||
'src.scripts',
|
||||
'src.web.news',
|
||||
'src.web.website',)
|
||||
'src.web.webclient')
|
||||
# The user profile extends the User object with more functionality;
|
||||
# This should usually not be changed.
|
||||
AUTH_USER_MODEL = "players.PlayerDB"
|
||||
|
|
|
|||
|
|
@ -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")]
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 678 KiB After Width: | Height: | Size: 678 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
|
@ -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 %}
|
||||
|
|
|
|||
|
|
@ -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}}
|
||||
|
|
@ -45,13 +46,13 @@
|
|||
<div class="headerLinks">
|
||||
<span class="doNotDisplay">Tools:</span>
|
||||
{% if user.is_authenticated %}
|
||||
<a href="/accounts/logout/">Log Out «</a>
|
||||
<a href="{% url 'logout' %}">Log Out «</a>
|
||||
<span class="doNotDisplay">|</span>
|
||||
Logged in as {{user.username}} «
|
||||
{% else %}
|
||||
<a href="/accounts/login/">Log In «</a>
|
||||
<a href="{% url 'login' %}">Log In «</a>
|
||||
<span class="doNotDisplay">|</span>
|
||||
<a href="/tbi">Register «</a>
|
||||
<a href="{% url 'to_be_implemented' %}">Register «</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>
|
||||
|
|
|
|||
|
|
@ -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>.
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
])
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
@ -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>
|
||||
|
||||
|
|
@ -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")]
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
#
|
||||
# Define database entities for the app.
|
||||
#
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
|
@ -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'),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue