Browse files

Expanded readme to include CLI options and settings.py configuration.

  • Loading branch information...
1 parent 4f53ec5 commit eb4995b5cd33f95cd77a9fba704d937a0cfbb79c @dcramer dcramer committed Nov 16, 2011
Showing with 79 additions and 46 deletions.
  1. +79 −46 README.rst
View
125 README.rst
@@ -6,11 +6,8 @@ A drop in replacement for Django's built-in runserver command. Features include:
* An extendable interface for handling things such as real-time logging.
* Integration with the werkzeug interactive debugger.
-* An improved runserver allowing you to process requests simultaneously.
-
-.. image:: http://www.pastethat.com/media/files/2010/02/10/Screen_shot_2010-02-10_at_10.05.31_PM.png
- :alt: devserver screenshot
-
+* Threaded (default) and multi-process development servers.
+* Ability to specify a WSGI application as your target environment.
------------
Installation
@@ -35,24 +32,6 @@ You will need to include ``devserver`` in your ``INSTALLED_APPS``::
'devserver',
)
-Specify modules to load via the ``DEVSERVER_MODULES`` setting::
-
- DEVSERVER_MODULES = (
- 'devserver.modules.sql.SQLRealTimeModule',
- 'devserver.modules.sql.SQLSummaryModule',
- 'devserver.modules.profile.ProfileSummaryModule',
-
- # Modules not enabled by default
- 'devserver.modules.ajax.AjaxDumpModule',
- 'devserver.modules.profile.MemoryUseModule',
- 'devserver.modules.cache.CacheSummaryModule',
- 'devserver.modules.profile.LineProfilerModule',
- )
-
-You may also specify prefixes to skip processing for. By default, ``ADMIN_MEDIA_PREFIX``, ``MEDIA_URL`` and ``STATIC_URL`` (for Django >= 1.3) will be ignored (assuming ``MEDIA_URL`` and ``STATIC_URL`` is relative)::
-
- DEVSERVER_IGNORED_PREFIXES = ['/media', '/uploads']
-
-----
Usage
-----
@@ -65,50 +44,103 @@ Note: This will force ``settings.DEBUG`` to ``True``.
By default, ``devserver`` would bind itself to 127.0.0.1:8000. To change this default, ``DEVSERVER_DEFAULT_ADDR`` and ``DEVSERVER_DEFAULT_PORT`` settings are available.
-Please see ``python manage.py runserver --help`` for additional options.
+Additional CLI Options
+~~~~~~~~~~~~~~~~~~~~~~
+
+--werkzeug
+ Tells Django to use the Werkzeug interactive debugger, instead of it's own.
+
+--forked
+ Use a forking (multi-process) web server instead of threaded.
-You may also use devserver's middleware outside of the management command::
+--dozer
+ Enable the dozer memory debugging middleware (at /_dozer)
+
+--wsgi-app
+ Load the specified WSGI app as the server endpoint.
+
+Please see ``python manage.py runserver --help`` for more information additional options.
+
+Note: You may also use devserver's middleware outside of the management command::
MIDDLEWARE_CLASSES = (
- 'devserver.middleware.DevServerMiddleware',
+ 'devserver.middleware.DevServerMiddleware',
)
+-------------
+Configuration
+-------------
+
+The following options may be configured via your ``settings.py``:
+
+DEVSERVER_ARGS = []
+ Additional command line arguments to pass to the ``runserver`` command (as defaults).
+
+DEVSERVER_DEFAULT_ADDR = '127.0.0.1'
+ The default address to bind to.
+
+DEVSERVER_DEFAULT_PORT = '8000'
+ The default port to bind to.
+
+DEVSERVER_WSGI_MIDDLEWARE
+ A list of additional WSGI middleware to apply to the ``runserver`` command.
+
+DEVSERVER_MODULES = []
+ A list of devserver modules to load.
+
+DEVSERVER_IGNORED_PREFIXES = ['/media', '/uploads']
+ A list of prefixes to surpress and skip process on. By default, ``ADMIN_MEDIA_PREFIX``, ``MEDIA_URL`` and ``STATIC_URL`` (for Django >= 1.3) will be ignored (assuming ``MEDIA_URL`` and ``STATIC_URL`` is relative)::
+
+
-------
Modules
-------
-django-devserver includes several modules by default, but is also extendable by 3rd party modules.
+django-devserver includes several modules by default, but is also extendable by 3rd party modules. This is done via the ``DEVSERVER_MODULES`` setting::
+
+ DEVSERVER_MODULES = (
+ 'devserver.modules.sql.SQLRealTimeModule',
+ 'devserver.modules.sql.SQLSummaryModule',
+ 'devserver.modules.profile.ProfileSummaryModule',
+
+ # Modules not enabled by default
+ 'devserver.modules.ajax.AjaxDumpModule',
+ 'devserver.modules.profile.MemoryUseModule',
+ 'devserver.modules.cache.CacheSummaryModule',
+ 'devserver.modules.profile.LineProfilerModule',
+ )
devserver.modules.sql.SQLRealTimeModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Outputs queries as they happen to the terminal, including time taken.
+Outputs queries as they happen to the terminal, including time taken.
- Disable SQL query truncation (used in SQLRealTimeModule) with the ``DEVSERVER_TRUNCATE_SQL`` setting::
+Disable SQL query truncation (used in SQLRealTimeModule) with the ``DEVSERVER_TRUNCATE_SQL`` setting::
- DEVSERVER_TRUNCATE_SQL = False
+ DEVSERVER_TRUNCATE_SQL = False
devserver.modules.sql.SQLSummaryModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Outputs a summary of your SQL usage.
+
+Outputs a summary of your SQL usage.
devserver.modules.profile.ProfileSummaryModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Outputs a summary of the request performance.
+Outputs a summary of the request performance.
devserver.modules.profile.MemoryUseModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Outputs a notice when memory use is increased (at the end of a request cycle).
+Outputs a notice when memory use is increased (at the end of a request cycle).
devserver.modules.profile.LineProfilerModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Profiles view methods on a line by line basis. There are 2 ways to profile your view functions, by setting setting.DEVSERVER_AUTO_PROFILE = True or by decorating the view functions you want profiled with devserver.modules.profile.devserver_profile. The decoration takes an optional argument ``follow`` which is a sequence of functions that are called by your view function that you would also like profiled.
+Profiles view methods on a line by line basis. There are 2 ways to profile your view functions, by setting setting.DEVSERVER_AUTO_PROFILE = True or by decorating the view functions you want profiled with devserver.modules.profile.devserver_profile. The decoration takes an optional argument ``follow`` which is a sequence of functions that are called by your view function that you would also like profiled.
- An example of a decorated function::
+An example of a decorated function::
- @devserver_profile(follow=[foo, bar])
- def home(request):
- result['foo'] = foo()
- result['bar'] = bar()
+ @devserver_profile(follow=[foo, bar])
+ def home(request):
+ result['foo'] = foo()
+ result['bar'] = bar()
When using the decorator, we recommend that rather than import the decoration directly from devserver that you have code somewhere in your project like::
@@ -130,21 +162,22 @@ By importing the decoration using this method, devserver_profile will be a pass
devserver.modules.cache.CacheSummaryModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Outputs a summary of your cache calls at the end of the request.
+
+Outputs a summary of your cache calls at the end of the request.
devserver.modules.ajax.AjaxDumpModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Outputs the content of any AJAX responses
-
- Change the maximum response length to dump with the ``DEVSERVER_AJAX_CONTENT_LENGTH`` setting::
+
+Outputs the content of any AJAX responses
- DEVSERVER_AJAX_CONTENT_LENGTH = 300
+Change the maximum response length to dump with the ``DEVSERVER_AJAX_CONTENT_LENGTH`` setting::
+
+ DEVSERVER_AJAX_CONTENT_LENGTH = 300
devserver.modules.request.SessionInfoModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Outputs information about the current session and user.
-
+Outputs information about the current session and user.
----------------
Building Modules

0 comments on commit eb4995b

Please sign in to comment.