diff --git a/evennia/game_template/server/conf/settings.py b/evennia/game_template/server/conf/settings.py index 9a29edd535..2f8d550775 100644 --- a/evennia/game_template/server/conf/settings.py +++ b/evennia/game_template/server/conf/settings.py @@ -83,14 +83,14 @@ STATIC_ROOT = os.path.join(GAME_DIR, "web", "static") # Directories from which static files will be gathered from. STATICFILES_DIRS = ( os.path.join(GAME_DIR, "web", "static_overrides"), - os.path.join(EVENNIA_DIR, "web", "static"),) + os.path.join(EVENNIA_DIR, "web", "website", "static"),) # We setup the location of the website template as well as the admin site. TEMPLATE_DIRS = ( os.path.join(GAME_DIR, "web", "template_overrides", ACTIVE_TEMPLATE), os.path.join(GAME_DIR, "web", "template_overrides"), - os.path.join(EVENNIA_DIR, "web", "templates", ACTIVE_TEMPLATE), - os.path.join(EVENNIA_DIR, "web", "templates"),) + os.path.join(EVENNIA_DIR, "web", "website", "templates", ACTIVE_TEMPLATE), + os.path.join(EVENNIA_DIR, "web", "website", "templates"),) # The secret key is randomly seeded upon creation. It is used to sign # Django's cookies. Do not share this with anyone. Changing it will diff --git a/evennia/game_template/web/urls.py b/evennia/game_template/web/urls.py index 357b30f2db..ad1351ca60 100644 --- a/evennia/game_template/web/urls.py +++ b/evennia/game_template/web/urls.py @@ -1,25 +1,18 @@ +""" +Url definition file to redistribute incoming URL requests to django +views. Search the Django documentation for "URL dispatcher" for more +help. + +""" from django.conf.urls import url, include +# default evennia patterns from evennia.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 -# - -# Add your own URL patterns to the patterns variable below, and then change -# -# 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/ - -# Follow the full Django tutorial to learn how to create web views for Evennia. -# https://docs.djangoproject.com/en/1.6/intro/tutorial01/ - -patterns = [ +# eventual custom patterns +custom_patterns = [ # url(r'/desired/url/', view, name='example'), ] -urlpatterns = patterns + urlpatterns +# this is used by Django. +urlpatterns = custom_patterns + urlpatterns diff --git a/evennia/settings_default.py b/evennia/settings_default.py index 646cb8b641..78a4b078f2 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -568,7 +568,7 @@ LOCALE_PATHS = [os.path.join(EVENNIA_DIR, "locale/")] SERVE_MEDIA = False # The master urlconf file that contains all of the sub-branches to the # applications. Change this to add your own URLs to the website. -ROOT_URLCONF = 'web.urls' #src.web.urls? +ROOT_URLCONF = '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. @@ -585,22 +585,22 @@ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(GAME_DIR, "web", "static") -# Directories from which static files will be gathered. +# Location of static data to overload the defaults from +# evennia/web/webclient and evennia/web/website's static/ dirs. STATICFILES_DIRS = ( - os.path.join(GAME_DIR, "web", "static_overrides"), - os.path.join(EVENNIA_DIR, "web", "static"),) + os.path.join(GAME_DIR, "web", "static_overrides"),) # Patterns of files in the static directories. Used here to make sure that # its readme file is preserved but unused. STATICFILES_IGNORE_PATTERNS = ('README.md',) # The name of the currently selected web template. This corresponds to the -# directory names shown in the webtemplates directory. -ACTIVE_TEMPLATE = 'prosimii' +# directory names shown in the templates directory. +ACTIVE_TEMPLATE = 'website' # We setup the location of the website template as well as the admin site. TEMPLATE_DIRS = ( os.path.join(GAME_DIR, "web", "template_overrides", ACTIVE_TEMPLATE), os.path.join(GAME_DIR, "web", "template_overrides"), - os.path.join(EVENNIA_DIR, "web", "templates", ACTIVE_TEMPLATE), - os.path.join(EVENNIA_DIR, "web", "templates"),) + os.path.join(EVENNIA_DIR, "web", "website", "templates", ACTIVE_TEMPLATE), + os.path.join(EVENNIA_DIR, "web", "website", "templates"),) # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', @@ -634,12 +634,12 @@ TEMPLATE_CONTEXT_PROCESSORS = ( # refer to app models and perform DB syncs. INSTALLED_APPS = ( 'django.contrib.auth', - 'django.contrib.sites', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.flatpages', + 'django.contrib.sites', 'django.contrib.staticfiles', 'evennia.utils.idmapper', 'evennia.server', @@ -649,6 +649,7 @@ INSTALLED_APPS = ( 'evennia.comms', 'evennia.help', 'evennia.scripts', + 'evennia.web.website', 'evennia.web.webclient') # The user profile extends the User object with more functionality; # This should usually not be changed. diff --git a/evennia/web/urls.py b/evennia/web/urls.py old mode 100755 new mode 100644 index 63ddfd15e2..8539ae82b9 --- a/evennia/web/urls.py +++ b/evennia/web/urls.py @@ -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.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), - url(r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}) - ]) + # favicon + url(r'^favicon\.ico$', RedirectView.as_view(url='/media/images/favicon.ico', permanent=False)) + ] diff --git a/evennia/web/webclient/models.py b/evennia/web/webclient/models.py deleted file mode 100644 index 89e59e2200..0000000000 --- a/evennia/web/webclient/models.py +++ /dev/null @@ -1,7 +0,0 @@ -# -# Define database entities for the app. -# - -from django.db import models - - diff --git a/evennia/web/website/__init__.py b/evennia/web/website/__init__.py new file mode 100644 index 0000000000..367ac87e7c --- /dev/null +++ b/evennia/web/website/__init__.py @@ -0,0 +1 @@ +# The Evennia default website. diff --git a/evennia/web/static/evennia_general/css/prosimii-print.css b/evennia/web/website/static/website/css/prosimii-print.css similarity index 100% rename from evennia/web/static/evennia_general/css/prosimii-print.css rename to evennia/web/website/static/website/css/prosimii-print.css diff --git a/evennia/web/static/evennia_general/css/prosimii-screen-alt.css b/evennia/web/website/static/website/css/prosimii-screen-alt.css similarity index 100% rename from evennia/web/static/evennia_general/css/prosimii-screen-alt.css rename to evennia/web/website/static/website/css/prosimii-screen-alt.css diff --git a/evennia/web/static/evennia_general/css/prosimii-screen.css b/evennia/web/website/static/website/css/prosimii-screen.css similarity index 100% rename from evennia/web/static/evennia_general/css/prosimii-screen.css rename to evennia/web/website/static/website/css/prosimii-screen.css diff --git a/evennia/web/static/evennia_general/images/LICENCE b/evennia/web/website/static/website/images/LICENCE similarity index 100% rename from evennia/web/static/evennia_general/images/LICENCE rename to evennia/web/website/static/website/images/LICENCE diff --git a/evennia/web/static/evennia_general/images/evennia_logo.png b/evennia/web/website/static/website/images/evennia_logo.png similarity index 100% rename from evennia/web/static/evennia_general/images/evennia_logo.png rename to evennia/web/website/static/website/images/evennia_logo.png diff --git a/evennia/web/static/evennia_general/images/favicon.ico b/evennia/web/website/static/website/images/favicon.ico similarity index 100% rename from evennia/web/static/evennia_general/images/favicon.ico rename to evennia/web/website/static/website/images/favicon.ico diff --git a/evennia/web/templates/prosimii/404.html b/evennia/web/website/templates/website/404.html similarity index 100% rename from evennia/web/templates/prosimii/404.html rename to evennia/web/website/templates/website/404.html diff --git a/evennia/web/templates/prosimii/500.html b/evennia/web/website/templates/website/500.html similarity index 100% rename from evennia/web/templates/prosimii/500.html rename to evennia/web/website/templates/website/500.html diff --git a/evennia/web/templates/prosimii/base.html b/evennia/web/website/templates/website/base.html similarity index 76% rename from evennia/web/templates/prosimii/base.html rename to evennia/web/website/templates/website/base.html index 565e0b5cee..6b5320e400 100644 --- a/evennia/web/templates/prosimii/base.html +++ b/evennia/web/website/templates/website/base.html @@ -9,12 +9,12 @@ {% if sidebar %} - + {% else %} - + {% endif %} - - + + {% block header_ext %} {% endblock %} @@ -35,7 +35,7 @@
-

{{game_name}}

+

{{game_name}}

{{game_slogan}}   @@ -66,7 +66,7 @@ {% if webclient_enabled %} | Play Online {% endif %} - +
@@ -83,10 +83,10 @@