Ticket #4704: runapp.patch

File runapp.patch, 1.4 KB (added by Vladimir "Farcaller" Pouzanov <farcaller@…>, 17 years ago)
  • django/core/management.py

     
    12941294    transaction.commit_unless_managed()
    12951295createcachetable.args = "[tablename]"
    12961296
     1297def run_app(args):
     1298    "Runs a func from module in django context"
     1299    from django.db.models.loading import get_models
     1300    loaded_models = get_models()
     1301
     1302    name, func = args[0], args[1]
     1303    module = __import__(name, globals(), locals(), name)
     1304    module.__getattribute__(func)()
     1305
     1306run_app.help_doc = 'Runs a func from module in django context'
     1307run_app.args = "name, func"
     1308
    12971309def run_shell(use_plain=False):
    12981310    "Runs a Python interactive interpreter. Tries to use IPython, if it's available."
    12991311    # XXX: (Temporary) workaround for ticket #1796: force early loading of all
     
    15251537    'runfcgi': runfcgi,
    15261538    'runserver': runserver,
    15271539    'shell': run_shell,
     1540    'runapp': run_app,
    15281541    'sql': get_sql_create,
    15291542    'sqlall': get_sql_all,
    15301543    'sqlclear': get_sql_delete,
     
    16711684        action_mapping[action](addr, port, options.use_reloader, options.admin_media_path)
    16721685    elif action == 'runfcgi':
    16731686        action_mapping[action](args[1:])
     1687    elif action == 'runapp':
     1688        action_mapping[action](args[1:])
    16741689    elif action == 'sqlinitialdata':
    16751690        print action_mapping[action](args[1:])
    16761691    elif action == 'sqlflush':
Back to Top