Merge lp:~canonical-isd-hackers/canonical-identity-provider/add-devserver into lp:canonical-identity-provider/release

Proposed by Łukasz Czyżykowski
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: no longer in the source branch.
Merged at revision: 184
Proposed branch: lp:~canonical-isd-hackers/canonical-identity-provider/add-devserver
Merge into: lp:canonical-identity-provider/release
Diff against target: 107 lines (+34/-26)
5 files modified
django_project/config_dev/config/devel-13.cfg (+15/-0)
identityprovider/schema.py (+13/-0)
payload/__init__.py (+3/-3)
requirements.txt (+3/-0)
wsgiserver.py (+0/-23)
To merge this branch: bzr merge lp:~canonical-isd-hackers/canonical-identity-provider/add-devserver
Reviewer Review Type Date Requested Status
Ricardo Kirkner (community) Approve
Review via email: mp+67675@code.launchpad.net

Commit message

Add django-devserver to the project.

Description of the change

Overview
========
This branch adds django-devserver to the project.

Details
=======
The change includes:
- adding new items to the requirements.txt file: devserver itself and two of its optional dependencies,
- adding devserver's configuration variables to the schema,
- adding example and usable configuration for devserver to the devel-13.cfg config file
- adding new fabric task (devserver).

Testing
=======
To test this feature follow instructions in the README file and then run it by using:

    $ fab devserver

and use site. You should see SQL output as well as some other additional information.

To post a comment you must log in.
Revision history for this message
Ricardo Kirkner (ricardokirkner) wrote :

Nice addition!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'django_project/config_dev/config/devel-13.cfg'
2--- django_project/config_dev/config/devel-13.cfg 2011-06-28 14:47:35 +0000
3+++ django_project/config_dev/config/devel-13.cfg 2011-07-12 13:52:37 +0000
4@@ -14,6 +14,7 @@
5 oauth_backend
6 preflight
7 gargoyle
8+ devserver
9 template_context_processors =
10 django.contrib.auth.context_processors.auth
11 django.core.context_processors.debug
12@@ -48,3 +49,17 @@
13 port = %(db_port)s
14
15 [django_logging]
16+
17+[devserver]
18+devserver_ignored_prefixes = /assets
19+devserver_auto_profile = True
20+devserver_modules =
21+ devserver.modules.sql.SQLRealTimeModule
22+ devserver.modules.sql.SQLSummaryModule
23+ devserver.modules.profile.ProfileSummaryModule
24+ devserver.modules.cache.CacheSummaryModule
25+ devserver.modules.profile.LineProfilerModule
26+# Modules not enabled by default
27+# devserver.modules.ajax.AjaxDumpModule
28+# devserver.modules.profile.MemoryUseModule
29+# devserver.modules.profile.LineProfilerModule
30\ No newline at end of file
31
32=== modified file 'identityprovider/schema.py'
33--- identityprovider/schema.py 2011-06-28 14:47:54 +0000
34+++ identityprovider/schema.py 2011-07-12 13:52:37 +0000
35@@ -149,3 +149,16 @@
36 profile.profile_pattern = StringConfigOption(
37 default="identityprovider\..*",
38 help="Regex pattern for limiting functions to be considered for profiling")
39+
40+ devserver = ConfigSection()
41+ devserver.devserver_ignored_prefixes = LinesConfigOption(
42+ item=StringConfigOption(),
43+ help="List of url prefixes which will be ignored")
44+ devserver.devserver_modules = LinesConfigOption(
45+ item=StringConfigOption(),
46+ help="List of devserver modules to enable")
47+ devserver.devserver_default_addr = StringConfigOption(default="127.0.0.1")
48+ devserver.devserver_default_port = StringConfigOption(default="8000")
49+ devserver.devserver_truncate_sql = BoolConfigOption(default=True)
50+ devserver.devserver_ajax_content_length = IntConfigOption(default=300)
51+ devserver.devserver_auto_profile = BoolConfigOption(default=False)
52
53=== modified file 'payload/__init__.py'
54--- payload/__init__.py 2011-07-08 16:51:25 +0000
55+++ payload/__init__.py 2011-07-12 13:52:37 +0000
56@@ -92,9 +92,9 @@
57
58
59 def run():
60- """Run development server using whole WSGI stack."""
61- virtualenv('python wsgiserver.py', capture=False)
62-
63+ """Run SSO using devserver."""
64+ virtualenv('python django_project/manage.py runserver ' + ' '.join(args),
65+ capture=False)
66
67 # deploy
68 def makemessages():
69
70=== modified file 'requirements.txt'
71--- requirements.txt 2011-07-06 17:36:56 +0000
72+++ requirements.txt 2011-07-12 13:52:37 +0000
73@@ -15,3 +15,6 @@
74
75 # development dependencies
76 werkzeug
77+django-devserver==0.1.7
78+sqlparse==0.1.2
79+line_profiler==1.0b2
80
81=== removed file 'wsgiserver.py'
82--- wsgiserver.py 2011-03-14 19:17:40 +0000
83+++ wsgiserver.py 1970-01-01 00:00:00 +0000
84@@ -1,23 +0,0 @@
85-# Copyright 2010 Canonical Ltd. This software is licensed under the
86-# GNU Affero General Public License version 3 (see the file LICENSE).
87-
88-from SocketServer import ThreadingMixIn
89-from wsgiref.simple_server import WSGIServer, make_server
90-
91-import os
92-import sys
93-sys.path.insert(0, os.path.abspath('django_project'))
94-os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
95-
96-from identityprovider.wsgi import make_app
97-
98-class ThreadedWSGIServer(ThreadingMixIn, WSGIServer):
99- pass
100-
101-httpd = make_server('', 8000, make_app(), server_class=ThreadedWSGIServer)
102-
103-
104-print "Serving HTTP on port 8000..."
105-
106-# Respond to requests until process is killed
107-httpd.serve_forever()