Removed creation of admin media symlink. Fixed media handling.
This commit is contained in:
parent
def97b58a8
commit
7499932337
3 changed files with 3 additions and 44 deletions
1
game/gamesrc/web/media/README.md
Normal file
1
game/gamesrc/web/media/README.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
This directory is where file uploads from Django apps are placed by default.
|
||||||
|
|
@ -180,42 +180,6 @@ def start_game_time():
|
||||||
gametime.init_gametime()
|
gametime.init_gametime()
|
||||||
|
|
||||||
|
|
||||||
def create_admin_media_links():
|
|
||||||
"""
|
|
||||||
This traverses to src/web/media and tries to create a symbolic
|
|
||||||
link to the django media files from within the MEDIA_ROOT.
|
|
||||||
These are files we normally don't
|
|
||||||
want to mess with (use templates to customize the admin
|
|
||||||
look). Linking is needed since the Twisted webserver otherwise has no
|
|
||||||
notion of where the default files are - and we cannot hard-code it
|
|
||||||
since the django install may be at different locations depending
|
|
||||||
on system.
|
|
||||||
"""
|
|
||||||
import django
|
|
||||||
import os
|
|
||||||
|
|
||||||
if django.get_version() < 1.4:
|
|
||||||
dpath = os.path.join(django.__path__[0], 'contrib', 'admin', 'media')
|
|
||||||
else:
|
|
||||||
dpath = os.path.join(django.__path__[0], 'contrib', 'admin', 'static', 'admin')
|
|
||||||
apath = os.path.join(settings.ADMIN_MEDIA_ROOT)
|
|
||||||
if os.path.isdir(apath):
|
|
||||||
print " ADMIN_MEDIA_ROOT already exists. Ignored."
|
|
||||||
return
|
|
||||||
if os.name == 'nt':
|
|
||||||
print " Admin-media files copied to ADMIN_MEDIA_ROOT (Windows mode)."
|
|
||||||
os.mkdir(apath)
|
|
||||||
os.system('xcopy "%s" "%s" /e /q /c' % (dpath, apath))
|
|
||||||
if os.name == 'posix':
|
|
||||||
try:
|
|
||||||
os.symlink(dpath, apath)
|
|
||||||
print " Admin-media symlinked to ADMIN_MEDIA_ROOT."
|
|
||||||
except OSError, e:
|
|
||||||
print " There was an error symlinking Admin-media to ADMIN_MEDIA_ROOT:\n %s\n -> \n %s\n (%s)\n If you see issues, link manually." % (dpath, apath, e)
|
|
||||||
else:
|
|
||||||
print " Admin-media files should be copied manually to ADMIN_MEDIA_ROOT."
|
|
||||||
|
|
||||||
|
|
||||||
def at_initial_setup():
|
def at_initial_setup():
|
||||||
"""
|
"""
|
||||||
Custom hook for users to overload some or all parts of the initial
|
Custom hook for users to overload some or all parts of the initial
|
||||||
|
|
@ -269,7 +233,6 @@ def handle_setup(last_step):
|
||||||
create_channels,
|
create_channels,
|
||||||
create_system_scripts,
|
create_system_scripts,
|
||||||
start_game_time,
|
start_game_time,
|
||||||
create_admin_media_links,
|
|
||||||
at_initial_setup,
|
at_initial_setup,
|
||||||
reset_server
|
reset_server
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -457,14 +457,9 @@ TEMPLATE_DEBUG = DEBUG
|
||||||
ADMINS = () #'Your Name', 'your_email@domain.com'),)
|
ADMINS = () #'Your Name', 'your_email@domain.com'),)
|
||||||
# These guys get broken link notifications when SEND_BROKEN_LINK_EMAILS is True.
|
# These guys get broken link notifications when SEND_BROKEN_LINK_EMAILS is True.
|
||||||
MANAGERS = ADMINS
|
MANAGERS = ADMINS
|
||||||
# Absolute path to the directory that holds media (no trailing slash).
|
# Absolute path to the directory that holds file uploads from web apps.
|
||||||
# Example: "/home/media/media.lawrence.com"
|
# Example: "/home/media/media.lawrence.com"
|
||||||
MEDIA_ROOT = os.path.join(SRC_DIR, 'web', 'media')
|
MEDIA_ROOT = os.path.join(GAME_DIR, "gamesrc", "web", "media")
|
||||||
# Absolute path to the directory that holds (usually links to) the
|
|
||||||
# django admin media files. If the target directory does not exist, it
|
|
||||||
# is created and linked by Evennia upon first start. Otherwise link it
|
|
||||||
# manually to django/contrib/admin/media.
|
|
||||||
ADMIN_MEDIA_ROOT = os.path.join(MEDIA_ROOT, 'admin')
|
|
||||||
# It's safe to dis-regard this, as it's a Django feature we only half use as a
|
# It's safe to dis-regard this, as it's a Django feature we only half use as a
|
||||||
# dependency, not actually what it's primarily meant for.
|
# dependency, not actually what it's primarily meant for.
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue