Ticket #4996: patch.2.diff

File patch.2.diff, 2.6 KB (added by Charlie La Mothe <charlie@…>, 17 years ago)
  • docs/django-admin.txt

     
    309309
    310310    django-admin.py runserver --noreload
    311311
     312Run as daemon
     313~~~~~~~~~~~~~~~~~~~~~~~
     314If you wish to run the development server as a daemon, use the ``--daemonize`` option, like so::
     315
     316    django-admin.py runserver --daemonize
     317
    312318shell
    313319-----
    314320
  • django/core/management.py

     
    12021202        sys.stderr.write(s.read())
    12031203        sys.exit(1)
    12041204
    1205 def runserver(addr, port, use_reloader=True, admin_media_dir=''):
     1205def runserver(addr, port, use_reloader=True, admin_media_dir='', daemonize=False):
    12061206    "Starts a lightweight Web server for development."
    12071207    from django.core.servers.basehttp import run, AdminMediaHandler, WSGIServerException
    12081208    from django.core.handlers.wsgi import WSGIHandler
     
    12401240            os._exit(1)
    12411241        except KeyboardInterrupt:
    12421242            sys.exit(0)
     1243    if daemonize:
     1244        from django.utils.daemonize import become_daemon
     1245        become_daemon()
    12431246    if use_reloader:
    12441247        from django.utils import autoreload
    12451248        autoreload.main(inner_run)
    12461249    else:
    12471250        inner_run()
    1248 runserver.args = '[--noreload] [--adminmedia=ADMIN_MEDIA_PATH] [optional port number, or ipaddr:port]'
     1251runserver.args = '[--daemonize] [--noreload] [--adminmedia=ADMIN_MEDIA_PATH] [optional port number, or ipaddr:port]'
    12491252
    12501253def createcachetable(tablename):
    12511254    "Creates the table needed to use the SQL cache backend"
     
    15751578        help='Tells Django to NOT prompt the user for input of any kind.')
    15761579    parser.add_option('--noreload', action='store_false', dest='use_reloader', default=True,
    15771580        help='Tells Django to NOT use the auto-reloader when running the development server.')
     1581    parser.add_option('--daemonize', action='store_true', dest='daemonize', default=False,
     1582        help='Tells Django to daemonize the the development server.')
    15781583    parser.add_option('--format', default='json', dest='format',
    15791584        help='Specifies the output serialization format for fixtures')
    15801585    parser.add_option('--indent', default=None, dest='indent',
     
    16561661                addr, port = args[1].split(':')
    16571662            except ValueError:
    16581663                addr, port = '', args[1]
    1659         action_mapping[action](addr, port, options.use_reloader, options.admin_media_path)
     1664        action_mapping[action](addr, port, options.use_reloader, options.admin_media_path, options.daemonize)
    16601665    elif action == 'runfcgi':
    16611666        action_mapping[action](args[1:])
    16621667    elif action == 'sqlinitialdata':
Back to Top