Skip to content

Commit eb4995b

Browse files
committed
Expanded readme to include CLI options and settings.py configuration.
1 parent 4f53ec5 commit eb4995b

File tree

1 file changed

+79
-46
lines changed

1 file changed

+79
-46
lines changed

README.rst

Lines changed: 79 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ A drop in replacement for Django's built-in runserver command. Features include:
66

77
* An extendable interface for handling things such as real-time logging.
88
* Integration with the werkzeug interactive debugger.
9-
* An improved runserver allowing you to process requests simultaneously.
10-
11-
.. image:: http://www.pastethat.com/media/files/2010/02/10/Screen_shot_2010-02-10_at_10.05.31_PM.png
12-
:alt: devserver screenshot
13-
9+
* Threaded (default) and multi-process development servers.
10+
* Ability to specify a WSGI application as your target environment.
1411

1512
------------
1613
Installation
@@ -35,24 +32,6 @@ You will need to include ``devserver`` in your ``INSTALLED_APPS``::
3532
'devserver',
3633
)
3734

38-
Specify modules to load via the ``DEVSERVER_MODULES`` setting::
39-
40-
DEVSERVER_MODULES = (
41-
'devserver.modules.sql.SQLRealTimeModule',
42-
'devserver.modules.sql.SQLSummaryModule',
43-
'devserver.modules.profile.ProfileSummaryModule',
44-
45-
# Modules not enabled by default
46-
'devserver.modules.ajax.AjaxDumpModule',
47-
'devserver.modules.profile.MemoryUseModule',
48-
'devserver.modules.cache.CacheSummaryModule',
49-
'devserver.modules.profile.LineProfilerModule',
50-
)
51-
52-
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)::
53-
54-
DEVSERVER_IGNORED_PREFIXES = ['/media', '/uploads']
55-
5635
-----
5736
Usage
5837
-----
@@ -65,50 +44,103 @@ Note: This will force ``settings.DEBUG`` to ``True``.
6544

6645
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.
6746

68-
Please see ``python manage.py runserver --help`` for additional options.
47+
Additional CLI Options
48+
~~~~~~~~~~~~~~~~~~~~~~
49+
50+
--werkzeug
51+
Tells Django to use the Werkzeug interactive debugger, instead of it's own.
52+
53+
--forked
54+
Use a forking (multi-process) web server instead of threaded.
6955

70-
You may also use devserver's middleware outside of the management command::
56+
--dozer
57+
Enable the dozer memory debugging middleware (at /_dozer)
58+
59+
--wsgi-app
60+
Load the specified WSGI app as the server endpoint.
61+
62+
Please see ``python manage.py runserver --help`` for more information additional options.
63+
64+
Note: You may also use devserver's middleware outside of the management command::
7165

7266
MIDDLEWARE_CLASSES = (
73-
'devserver.middleware.DevServerMiddleware',
67+
'devserver.middleware.DevServerMiddleware',
7468
)
7569

70+
-------------
71+
Configuration
72+
-------------
73+
74+
The following options may be configured via your ``settings.py``:
75+
76+
DEVSERVER_ARGS = []
77+
Additional command line arguments to pass to the ``runserver`` command (as defaults).
78+
79+
DEVSERVER_DEFAULT_ADDR = '127.0.0.1'
80+
The default address to bind to.
81+
82+
DEVSERVER_DEFAULT_PORT = '8000'
83+
The default port to bind to.
84+
85+
DEVSERVER_WSGI_MIDDLEWARE
86+
A list of additional WSGI middleware to apply to the ``runserver`` command.
87+
88+
DEVSERVER_MODULES = []
89+
A list of devserver modules to load.
90+
91+
DEVSERVER_IGNORED_PREFIXES = ['/media', '/uploads']
92+
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)::
93+
94+
7695
-------
7796
Modules
7897
-------
7998

80-
django-devserver includes several modules by default, but is also extendable by 3rd party modules.
99+
django-devserver includes several modules by default, but is also extendable by 3rd party modules. This is done via the ``DEVSERVER_MODULES`` setting::
100+
101+
DEVSERVER_MODULES = (
102+
'devserver.modules.sql.SQLRealTimeModule',
103+
'devserver.modules.sql.SQLSummaryModule',
104+
'devserver.modules.profile.ProfileSummaryModule',
105+
106+
# Modules not enabled by default
107+
'devserver.modules.ajax.AjaxDumpModule',
108+
'devserver.modules.profile.MemoryUseModule',
109+
'devserver.modules.cache.CacheSummaryModule',
110+
'devserver.modules.profile.LineProfilerModule',
111+
)
81112

82113
devserver.modules.sql.SQLRealTimeModule
83114
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84-
Outputs queries as they happen to the terminal, including time taken.
115+
Outputs queries as they happen to the terminal, including time taken.
85116

86-
Disable SQL query truncation (used in SQLRealTimeModule) with the ``DEVSERVER_TRUNCATE_SQL`` setting::
117+
Disable SQL query truncation (used in SQLRealTimeModule) with the ``DEVSERVER_TRUNCATE_SQL`` setting::
87118
88-
DEVSERVER_TRUNCATE_SQL = False
119+
DEVSERVER_TRUNCATE_SQL = False
89120

90121
devserver.modules.sql.SQLSummaryModule
91122
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92-
Outputs a summary of your SQL usage.
123+
124+
Outputs a summary of your SQL usage.
93125

94126
devserver.modules.profile.ProfileSummaryModule
95127
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96-
Outputs a summary of the request performance.
128+
Outputs a summary of the request performance.
97129

98130
devserver.modules.profile.MemoryUseModule
99131
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100-
Outputs a notice when memory use is increased (at the end of a request cycle).
132+
Outputs a notice when memory use is increased (at the end of a request cycle).
101133

102134
devserver.modules.profile.LineProfilerModule
103135
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104-
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.
136+
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.
105137

106-
An example of a decorated function::
138+
An example of a decorated function::
107139
108-
@devserver_profile(follow=[foo, bar])
109-
def home(request):
110-
result['foo'] = foo()
111-
result['bar'] = bar()
140+
@devserver_profile(follow=[foo, bar])
141+
def home(request):
142+
result['foo'] = foo()
143+
result['bar'] = bar()
112144

113145
When using the decorator, we recommend that rather than import the decoration directly from devserver that you have code somewhere in your project like::
114146

@@ -130,21 +162,22 @@ By importing the decoration using this method, devserver_profile will be a pass
130162

131163
devserver.modules.cache.CacheSummaryModule
132164
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133-
Outputs a summary of your cache calls at the end of the request.
165+
166+
Outputs a summary of your cache calls at the end of the request.
134167

135168
devserver.modules.ajax.AjaxDumpModule
136169
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137-
Outputs the content of any AJAX responses
138-
139-
Change the maximum response length to dump with the ``DEVSERVER_AJAX_CONTENT_LENGTH`` setting::
170+
171+
Outputs the content of any AJAX responses
140172

141-
DEVSERVER_AJAX_CONTENT_LENGTH = 300
173+
Change the maximum response length to dump with the ``DEVSERVER_AJAX_CONTENT_LENGTH`` setting::
174+
175+
DEVSERVER_AJAX_CONTENT_LENGTH = 300
142176

143177
devserver.modules.request.SessionInfoModule
144178
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145-
Outputs information about the current session and user.
146-
147179

180+
Outputs information about the current session and user.
148181

149182
----------------
150183
Building Modules

0 commit comments

Comments
 (0)