Made the default_settings file itself detect GAME_DIR, leading to a lot less cookie cutter in the gamedir/server/conf/settings.py file. Refactored the detection algorithm also in the launcher.
This commit is contained in:
parent
9bf09365d2
commit
6782ff1333
4 changed files with 52 additions and 104 deletions
|
|
@ -1,18 +1,27 @@
|
|||
"""
|
||||
Evennia settings file.
|
||||
|
||||
The full options are found in the default settings file found here:
|
||||
The available options are found in the default settings file found
|
||||
here:
|
||||
|
||||
{settings_default}
|
||||
|
||||
Note: Don't copy more from the default file than you actually intend to
|
||||
Remember:
|
||||
|
||||
Don't copy more from the default file than you actually intend to
|
||||
change; this will make sure that you don't overload upstream updates
|
||||
unnecessarily.
|
||||
|
||||
When changing a setting requiring a file system path (like
|
||||
path/to/actual/file.py), use GAME_DIR and EVENNIA_DIR to reference
|
||||
your game folder and the Evennia library folders respectively. Python
|
||||
paths (path.to.module) should be given relative to the game's root
|
||||
folder (typeclasses.foo) whereas paths within the Evennia library
|
||||
needs to be given explicitly (evennia.foo).
|
||||
|
||||
"""
|
||||
|
||||
# Use the defaults from Evennia unless explicitly overridden
|
||||
import os
|
||||
from evennia.settings_default import *
|
||||
|
||||
######################################################################
|
||||
|
|
@ -22,91 +31,10 @@ from evennia.settings_default import *
|
|||
# This is the name of your game. Make it catchy!
|
||||
SERVERNAME = {servername}
|
||||
|
||||
# Path to the game directory (use EVENNIA_DIR to refer to the
|
||||
# core evennia library)
|
||||
GAME_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
# Place to put log files
|
||||
LOG_DIR = os.path.join(GAME_DIR, "server", "logs")
|
||||
SERVER_LOG_FILE = os.path.join(LOG_DIR, 'server.log')
|
||||
PORTAL_LOG_FILE = os.path.join(LOG_DIR, 'portal.log')
|
||||
HTTP_LOG_FILE = os.path.join(LOG_DIR, 'http_requests.log')
|
||||
|
||||
# Other defaults
|
||||
PROTOTYPE_MODULES = ("world.prototypes",)
|
||||
|
||||
######################################################################
|
||||
# Evennia Database config
|
||||
######################################################################
|
||||
|
||||
# Database config syntax:
|
||||
# ENGINE - path to the the database backend. Possible choices are:
|
||||
# 'django.db.backends.sqlite3', (default)
|
||||
# 'django.db.backends.mysql',
|
||||
# 'django.db.backends.postgresql_psycopg2',
|
||||
# 'django.db.backends.oracle' (untested).
|
||||
# NAME - database name, or path to the db file for sqlite3
|
||||
# USER - db admin (unused in sqlite3)
|
||||
# PASSWORD - db admin password (unused in sqlite3)
|
||||
# HOST - empty string is localhost (unused in sqlite3)
|
||||
# PORT - empty string defaults to localhost (unused in sqlite3)
|
||||
DATABASES = {{
|
||||
'default': {{
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(GAME_DIR, "server", "evennia.db3"),
|
||||
'USER': '',
|
||||
'PASSWORD': '',
|
||||
'HOST': '',
|
||||
'PORT': ''
|
||||
}}}}
|
||||
|
||||
######################################################################
|
||||
# Django web features
|
||||
# (don't remove these entries, they are needed to override the default
|
||||
# locations with your actual GAME_DIR locations at run-time)
|
||||
######################################################################
|
||||
|
||||
# Absolute path to the directory that holds file uploads from web apps.
|
||||
# Example: "/home/media/media.lawrence.com"
|
||||
MEDIA_ROOT = os.path.join(GAME_DIR, "web", "media")
|
||||
|
||||
# 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'
|
||||
|
||||
# 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 = '/static/'
|
||||
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", "website", "static"),)
|
||||
|
||||
# We setup the location of the website template as well as the admin site.
|
||||
TEMPLATES = [{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
os.path.join(GAME_DIR, "web", "template_overrides", WEBSITE_TEMPLATE),
|
||||
os.path.join(GAME_DIR, "web", "template_overrides", WEBCLIENT_TEMPLATE),
|
||||
os.path.join(GAME_DIR, "web", "template_overrides"),
|
||||
os.path.join(EVENNIA_DIR, "web", "website", "templates", WEBSITE_TEMPLATE),
|
||||
os.path.join(EVENNIA_DIR, "web", "website", "templates"),
|
||||
os.path.join(EVENNIA_DIR, "web", "webclient", "templates", WEBCLIENT_TEMPLATE),
|
||||
os.path.join(EVENNIA_DIR, "web", "webclient", "templates")],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
"context_processors": [
|
||||
'django.template.context_processors.i18n',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.template.context_processors.media',
|
||||
'django.template.context_processors.debug',
|
||||
'evennia.web.utils.general_context.general_context']
|
||||
}
|
||||
}]
|
||||
|
||||
# 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue