mirror of
https://github.com/evennia/evennia.git
synced 2026-03-29 20:17:16 +02:00
After lots of discussions, default commands where moved from game/gamesrc/commands/default to src/commands/default in order to make it clearer which parts are updated as part of evennia and which can be tweaked at heart's content. New templates where left in gamesrc/commands that should hopefully make it clearer how to extend the command system. Also game/web was moved to src/web - we'll likely extend this from game/gamesrc/web in the future. If you already did extensions you should just have to edit your import paths and make use of the new cmdset template supplied.
The unit testing was for commands was split out from src/objects/tests.py into the new src/commands/default/test.py in order to keep the testing modules thematically grouped with the things they are testing.
This commit is contained in:
parent
a3917073ff
commit
72d40285b8
61 changed files with 381 additions and 184 deletions
0
src/web/utils/__init__.py
Normal file
0
src/web/utils/__init__.py
Normal file
16
src/web/utils/apache_wsgi.conf
Normal file
16
src/web/utils/apache_wsgi.conf
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import os, sys
|
||||
|
||||
# Calculate the path based on the location of the WSGI script.
|
||||
web_dir = os.path.dirname(os.path.dirname(__file__))
|
||||
workspace = os.path.dirname(os.path.dirname(web_dir))
|
||||
|
||||
sys.path.insert(0, workspace)
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'game.settings'
|
||||
import django.core.handlers.wsgi
|
||||
|
||||
_application = django.core.handlers.wsgi.WSGIHandler()
|
||||
# This handles apps mounted in places other than the root mount point
|
||||
def application(environ, start_response):
|
||||
environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO']
|
||||
return _application(environ, start_response)
|
||||
45
src/web/utils/evennia_modpy_apache.conf
Normal file
45
src/web/utils/evennia_modpy_apache.conf
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
# WARNING: mod_python is no longer the recommended way to run Evennia's
|
||||
# web front end. This file is no longer actively maintained and may
|
||||
# no longer work. We suggest using mod_wsgi unless absolutely necessary.
|
||||
|
||||
# Add this vhost file to your Apache sites-enabled directory, typically found
|
||||
# at /etc/apache2/sites-enabled. You'll need to go through and change the
|
||||
# /home/evennia to point to the correct home directory, and the evennia
|
||||
# subdir must be under that home directory.
|
||||
|
||||
# A NOTE ON IMAGES/CSS: These files must be handled separately from the actual
|
||||
# dynamic content which is interpreted by Python. You may host these static
|
||||
# images/css from the same server or a different one. The static media
|
||||
# is served from /home/evennia/evennia/media. The easiest way to serve
|
||||
# this stuff is by either hosting them remotely or symlinking
|
||||
# the media directory into an existing Apache site's directory.
|
||||
|
||||
# A NOTE ON ADMIN IMAGES/CSS: You'll need to create a symlink called
|
||||
# 'amedia' under the media directory if you want to use the admin interface.
|
||||
# This can be found in the Django package in your Python path. For example,
|
||||
# the default is: /usr/lib/python2.4/site-packages/django/contrib/admin/media/
|
||||
# although your location may vary.
|
||||
<VirtualHost *>
|
||||
# Set ServerName and ServerAdmin appropriately
|
||||
ServerName evennia.somewhere.com
|
||||
ServerAdmin someone@somewhere.com
|
||||
DocumentRoot /home/evennia/evennia
|
||||
|
||||
<Directory "/home/evennia/evennia">
|
||||
SetHandler python-program
|
||||
PythonHandler django.core.handlers.modpython
|
||||
PythonPath "['/home/evennia/evennia'] + sys.path"
|
||||
SetEnv DJANGO_SETTINGS_MODULE settings
|
||||
PythonDebug On
|
||||
</Directory>
|
||||
|
||||
Alias /media/ "/home/evennia/evennia/media/"
|
||||
<Directory "/home/evennia/evennia/media/">
|
||||
SetHandler None
|
||||
</Directory>
|
||||
|
||||
<LocationMatch "\.(jpg|gif|png|css)$">
|
||||
SetHandler None
|
||||
</LocationMatch>
|
||||
</VirtualHost>
|
||||
51
src/web/utils/evennia_wsgi_apache.conf
Normal file
51
src/web/utils/evennia_wsgi_apache.conf
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<VirtualHost *>
|
||||
# This is an example mod_wsgi apache2 vhost. There are a number of
|
||||
# things you'll need to change. They are commented below. Make sure
|
||||
# you read and understand the stuff below.
|
||||
|
||||
# Copy this file to your apache2 vhosts directory before editing.
|
||||
# This file is merely a template. The vhost directory is usually
|
||||
# something like /etc/apache2/sites-enabled/.
|
||||
|
||||
# You'll want to replace the following with your domain info.
|
||||
ServerName dev.evennia.com
|
||||
ServerAlias www.dev.evennia.com
|
||||
#
|
||||
## BEGIN EVENNIA WEB CONFIG
|
||||
#
|
||||
# evennia_web is just an internal name for mod_wsgi and may be left
|
||||
# The user and group options are the user and the group that the
|
||||
# python code will be executed under. This user must have permissions
|
||||
# to the evennia source.
|
||||
WSGIDaemonProcess evennia_web user=evennia group=evennia threads=25
|
||||
WSGIProcessGroup evennia_web
|
||||
|
||||
# This needs to be changed to the appropriate path on your django
|
||||
# install. It serves admin site media.
|
||||
# For Python 2.6, this is:
|
||||
# /usr/lib/python2.6/dist-packages/django/contrib/admin/media/
|
||||
Alias /media/amedia/ "/usr/lib/python2.5/site-packages/django/contrib/admin/media/"
|
||||
<Directory "/usr/lib/python2.5/site-packages/django/contrib/admin/media">
|
||||
Order allow,deny
|
||||
Options Indexes
|
||||
Allow from all
|
||||
IndexOptions FancyIndexing
|
||||
</Directory>
|
||||
|
||||
# Media Directory. This needs to be set to your equivalent path.
|
||||
Alias /media/ "/home/evennia/evennia/game/web/media/"
|
||||
<Directory "/home/evennia/evennia/game/web/media">
|
||||
Order allow,deny
|
||||
Options Indexes FollowSymLinks
|
||||
Allow from all
|
||||
IndexOptions FancyIndexing
|
||||
</Directory>
|
||||
|
||||
|
||||
# WSGI Config File. You'll need to update this path as well.
|
||||
WSGIScriptAlias / /home/evennia/evennia/game/web/utils/apache_wsgi.conf
|
||||
|
||||
#
|
||||
## END EVENNIA WEB CONFIG
|
||||
#
|
||||
</VirtualHost>
|
||||
46
src/web/utils/general_context.py
Normal file
46
src/web/utils/general_context.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# This file defines global variables that will always be
|
||||
# available in a view context without having to repeatedly
|
||||
# include it. For this to work, this file is included in
|
||||
# the settings file, in the TEMPLATE_CONTEXT_PROCESSORS
|
||||
# tuple.
|
||||
#
|
||||
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from src.utils.utils import get_evennia_version
|
||||
|
||||
# Determine the site name and server version
|
||||
|
||||
try:
|
||||
GAME_NAME = settings.SERVERNAME.strip()
|
||||
except AttributeError:
|
||||
GAME_NAME = "Evennia"
|
||||
SERVER_VERSION = get_evennia_version()
|
||||
|
||||
|
||||
# Setup lists of the most relevant apps so
|
||||
# the adminsite becomes more readable.
|
||||
|
||||
USER_RELATED = ['Auth', 'Players']
|
||||
GAME_ENTITIES = ['Objects', 'Scripts', 'Comms', 'Help']
|
||||
GAME_SETUP = ['Permissions', 'Config']
|
||||
CONNECTIONS = ['Irc', 'Imc2']
|
||||
WEBSITE = ['Flatpages', 'News', 'Sites']
|
||||
|
||||
# The main context processor function
|
||||
|
||||
def general_context(request):
|
||||
"""
|
||||
Returns common Evennia-related context stuff, which
|
||||
is automatically added to context of all views.
|
||||
"""
|
||||
return {
|
||||
'game_name': GAME_NAME,
|
||||
'game_slogan': SERVER_VERSION,
|
||||
'evennia_userapps': USER_RELATED,
|
||||
'evennia_entityapps': GAME_ENTITIES,
|
||||
'evennia_setupapps': GAME_SETUP,
|
||||
'evennia_connectapps': CONNECTIONS,
|
||||
'evennia_websiteapps':WEBSITE
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue