You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Threaded (default) and multi-process development servers.
10
+
* Ability to specify a WSGI application as your target environment.
14
11
15
12
------------
16
13
Installation
@@ -35,24 +32,6 @@ You will need to include ``devserver`` in your ``INSTALLED_APPS``::
35
32
'devserver',
36
33
)
37
34
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)::
@@ -65,50 +44,103 @@ Note: This will force ``settings.DEBUG`` to ``True``.
65
44
66
45
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.
67
46
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.
69
55
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::
71
65
72
66
MIDDLEWARE_CLASSES = (
73
-
'devserver.middleware.DevServerMiddleware',
67
+
'devserver.middleware.DevServerMiddleware',
74
68
)
75
69
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.
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
+
76
95
-------
77
96
Modules
78
97
-------
79
98
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
+
)
81
112
82
113
devserver.modules.sql.SQLRealTimeModule
83
114
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84
-
Outputs queries as they happen to the terminal, including time taken.
115
+
Outputs queries as they happen to the terminal, including time taken.
85
116
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::
87
118
88
-
DEVSERVER_TRUNCATE_SQL = False
119
+
DEVSERVER_TRUNCATE_SQL = False
89
120
90
121
devserver.modules.sql.SQLSummaryModule
91
122
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
-
Outputs a summary of your SQL usage.
123
+
124
+
Outputs a summary of your SQL usage.
93
125
94
126
devserver.modules.profile.ProfileSummaryModule
95
127
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96
-
Outputs a summary of the request performance.
128
+
Outputs a summary of the request performance.
97
129
98
130
devserver.modules.profile.MemoryUseModule
99
131
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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).
101
133
102
134
devserver.modules.profile.LineProfilerModule
103
135
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
105
137
106
-
An example of a decorated function::
138
+
An example of a decorated function::
107
139
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()
112
144
113
145
When using the decorator, we recommend that rather than import the decoration directly from devserver that you have code somewhere in your project like::
114
146
@@ -130,21 +162,22 @@ By importing the decoration using this method, devserver_profile will be a pass
130
162
131
163
devserver.modules.cache.CacheSummaryModule
132
164
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
134
167
135
168
devserver.modules.ajax.AjaxDumpModule
136
169
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
140
172
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
142
176
143
177
devserver.modules.request.SessionInfoModule
144
178
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145
-
Outputs information about the current session and user.
146
-
147
179
180
+
Outputs information about the current session and user.
0 commit comments