mirror of
https://github.com/evennia/evennia.git
synced 2026-03-31 04:57:16 +02:00
Removed the admin media files from the distribution again. Instead the server will now create the necessary symlink (Linux) or copy (Windows) of the default files in django/contrib/admin/media at initial startup. Currently only tested under Linux. If you don't want to re-run the initialization, copy/link the admin directory to ADMIN_MEDIA_PREFIX yourself. This deals with issue 124.
Also added a 'remove' functionality to the migrate.py script, for easily getting back the normal syncdb operation (useful when deleting/resetting the database a lot).
This commit is contained in:
parent
acc89d0be2
commit
f0b4c581f7
83 changed files with 74 additions and 103 deletions
|
|
@ -133,9 +133,13 @@ def start_daemon(parser, options, args):
|
|||
cycle_logfile()
|
||||
|
||||
# Start it up
|
||||
Popen([TWISTED_BINARY,
|
||||
'--logfile=%s' % settings.DEFAULT_LOG_FILE,
|
||||
'--python=%s' % SERVER_PY_FILE])
|
||||
# Popen([TWISTED_BINARY,
|
||||
# '--logfile=%s' % settings.DEFAULT_LOG_FILE,
|
||||
# '--python=%s' % SERVER_PY_FILE])
|
||||
call([TWISTED_BINARY,
|
||||
'--logfile=%s' % settings.DEFAULT_LOG_FILE,
|
||||
'--python=%s' % SERVER_PY_FILE])
|
||||
|
||||
|
||||
def start_interactive(parser, options, args):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ For more advanced migrations, there might be further instructions.
|
|||
|
||||
import os, sys
|
||||
from subprocess import call
|
||||
|
||||
import south
|
||||
|
||||
# Set the Python path up so we can get to settings.py from here.
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
|
@ -63,7 +63,7 @@ def run_south(mode):
|
|||
"""
|
||||
if mode == "init":
|
||||
for appname in APPLIST:
|
||||
print "Initializing %s ..." % appname
|
||||
print "Initializing %s ... (ignore missing directory tracebacks)" % appname
|
||||
call([sys.executable, "manage.py", "convert_to_south", appname])
|
||||
print "\nInitialization complete. That's all you need to do for now."
|
||||
elif mode == "update":
|
||||
|
|
@ -71,8 +71,21 @@ def run_south(mode):
|
|||
print "Updating/migrating schema for %s ..." % appname
|
||||
call([sys.executable, "manage.py", "schemamigration", appname, "--auto"])
|
||||
call([sys.executable, "manage.py", "migrate", appname])
|
||||
print "\nUpdate complete."
|
||||
|
||||
print "\nUpdate complete."
|
||||
elif mode == "remove":
|
||||
s = raw_input(" Warning, this cannot be undone. Continue? Y[N] > ")
|
||||
if s.lower() == 'y':
|
||||
from django.db.models import get_app
|
||||
import shutil
|
||||
for appname in APPLIST:
|
||||
print "Removing migrations for %s ..." % appname
|
||||
mod = get_app(appname)
|
||||
path = os.path.join(os.path.dirname(mod.__file__), 'migrations')
|
||||
try:
|
||||
shutil.rmtree(path)
|
||||
except OSError:
|
||||
print "%s didn't exist/could not be deleted. Ignored.." % path
|
||||
|
||||
def south_ui():
|
||||
"""
|
||||
Simple menu for handling migrations.
|
||||
|
|
@ -83,7 +96,7 @@ def south_ui():
|
|||
|
||||
You usually don't need to use this tool unless a new version of Evennia
|
||||
tells you that the database scheme changed in some way, AND you don't want
|
||||
to reset your database.
|
||||
to reset your database. If you
|
||||
|
||||
This tool will help you to migrate an existing database without having to
|
||||
manually edit your tables and fields to match the new scheme. For that
|
||||
|
|
@ -104,6 +117,7 @@ def south_ui():
|
|||
|
||||
i - Initialize an existing/new database with migration mappings (done once)
|
||||
u - Update an initialized database to the changed scheme
|
||||
r - Remove the migration scheme (back to normal syncdb operation)
|
||||
q - Quit
|
||||
"""
|
||||
|
||||
|
|
@ -111,11 +125,13 @@ def south_ui():
|
|||
print string
|
||||
inp = str(raw_input(" Option > "))
|
||||
inp = inp.lower()
|
||||
if inp in ["q", "i", "u"]:
|
||||
if inp in ["q", "i", "u", "r"]:
|
||||
if inp == 'i':
|
||||
run_south("init")
|
||||
elif inp == 'u':
|
||||
run_south("update")
|
||||
elif inp == 'r':
|
||||
run_south("remove")
|
||||
sys.exit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -182,11 +182,39 @@ def start_game_time():
|
|||
print " Starting in-game time ..."
|
||||
from src.utils import 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, os
|
||||
dpath = os.path.join(django.__path__[0], 'contrib', 'admin', 'media')
|
||||
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':
|
||||
os.symlink(dpath, apath)
|
||||
print " Admin-media symlinked to ADMIN_MEDIA_ROOT."
|
||||
else:
|
||||
print " Admin-media files should be copied manually to ADMIN_MEDIA_ROOT."
|
||||
|
||||
def handle_setup(last_step):
|
||||
"""
|
||||
Main logic for the module. It allows to restart the initialization
|
||||
if one of the modules should crash.
|
||||
Main logic for the module. It allows for restarting
|
||||
the initialization at any point if one of the modules
|
||||
should crash.
|
||||
"""
|
||||
|
||||
if last_step < 0:
|
||||
|
|
@ -206,7 +234,8 @@ def handle_setup(last_step):
|
|||
create_permission_groups,
|
||||
create_system_scripts,
|
||||
import_MUX_help_files,
|
||||
start_game_time]
|
||||
start_game_time,
|
||||
create_admin_media_links]
|
||||
|
||||
if not settings.IMPORT_MUX_HELP:
|
||||
# skip importing of the MUX helpfiles, they are
|
||||
|
|
|
|||
|
|
@ -349,6 +349,11 @@ MANAGERS = ADMINS
|
|||
# Absolute path to the directory that holds media (no trailing slash).
|
||||
# Example: "/home/media/media.lawrence.com"
|
||||
MEDIA_ROOT = os.path.join(SRC_DIR, '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
|
||||
# dependency, not actually what it's primarily meant for.
|
||||
SITE_ID = 1
|
||||
|
|
@ -367,13 +372,9 @@ SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
|||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = False
|
||||
# If you'd like to serve media files via Django (strongly not recommended!),
|
||||
# set SERVE_MEDIA to True. This is appropriate on a developing site, or if
|
||||
# you're running Django's built-in test server. Normally you want a webserver
|
||||
# that is optimized for serving static content to handle media files (apache,
|
||||
# lighttpd).
|
||||
# This should be turned off unless you want to do tests with Django's
|
||||
# development webserver (normally Evennia runs its own server)
|
||||
SERVE_MEDIA = False
|
||||
|
||||
# The master urlconf file that contains all of the sub-branches to the
|
||||
# applications.
|
||||
ROOT_URLCONF = 'src.web.urls'
|
||||
|
|
@ -386,9 +387,9 @@ LOGOUT_URL = '/accounts/login'
|
|||
# URL that handles the media served from MEDIA_ROOT.
|
||||
# Example: "http://media.lawrence.com"
|
||||
MEDIA_URL = '/media/'
|
||||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://foo.com/media/", "/media/".
|
||||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure
|
||||
# to use a trailing slash. This should match the position defined
|
||||
# by ADMIN_MEDIA_ROOT.
|
||||
ADMIN_MEDIA_PREFIX = '/media/admin/'
|
||||
# The name of the currently selected web template. This corresponds to the
|
||||
# directory names shown in the webtemplates directory.
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/css/base.css
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/css/changelists.css
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/css/dashboard.css
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/css/forms.css
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/css/ie.css
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/css/login.css
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/css/rtl.css
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/css/widgets.css
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/arrow-down.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/arrow-up.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/changelist-bg.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/changelist-bg_rtl.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/chooser-bg.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/chooser_stacked-bg.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/default-bg-reverse.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/default-bg.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/deleted-overlay.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon-no.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon-unknown.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon-yes.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_addlink.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_alert.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_calendar.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_changelink.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_clock.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_deletelink.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_error.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_searchbox.png
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/icon_success.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/inline-delete-8bit.png
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/inline-delete.png
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/inline-restore-8bit.png
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/inline-restore.png
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/inline-splitter-bg.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/nav-bg-grabber.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/nav-bg-reverse.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/nav-bg.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/selector-add.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/selector-addall.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/selector-remove.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/selector-removeall.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/selector-search.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/selector_stacked-add.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/selector_stacked-remove.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/tool-left.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/tool-left_over.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/tool-right.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/tool-right_over.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/tooltag-add.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/tooltag-add_over.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/tooltag-arrowright.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/admin/tooltag-arrowright_over.gif
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/gis/move_vertex_off.png
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/img/gis/move_vertex_on.png
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/LICENSE-JQUERY.txt
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/SelectBox.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/SelectFilter2.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/actions.js
|
||||
1
src/web/media/admin/js/actions.min.js
vendored
1
src/web/media/admin/js/actions.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/actions.min.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/admin/DateTimeShortcuts.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/admin/RelatedObjectLookups.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/admin/ordering.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/calendar.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/collapse.js
|
||||
1
src/web/media/admin/js/collapse.min.js
vendored
1
src/web/media/admin/js/collapse.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/collapse.min.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/compress.py
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/core.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/dateparse.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/getElementsBySelector.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/inlines.js
|
||||
1
src/web/media/admin/js/inlines.min.js
vendored
1
src/web/media/admin/js/inlines.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/inlines.min.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/jquery.init.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/prepopulate.js
|
||||
1
src/web/media/admin/js/prepopulate.min.js
vendored
1
src/web/media/admin/js/prepopulate.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/prepopulate.min.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/timeparse.js
|
||||
|
|
@ -1 +0,0 @@
|
|||
/usr/share/pyshared/django/contrib/admin/media/js/urlify.js
|
||||
|
|
@ -41,11 +41,8 @@ urlpatterns = patterns('',
|
|||
url(r'^webclient/',include('src.web.webclient.urls')),
|
||||
)
|
||||
|
||||
# If you'd like to serve media files via Django (strongly not recommended!),
|
||||
# open up your settings.py file and set SERVE_MEDIA to True. This is
|
||||
# appropriate on a developing site, or if you're running Django's built-in
|
||||
# test server. Normally you want a webserver that is optimized for serving
|
||||
# static content to handle media files (apache, lighttpd).
|
||||
# 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}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue