Update upload.py patch, add docs and example config files for running production server (issue3760048)

14 views
Skip to first unread message

ibmi...@gmail.com

unread,
Jan 12, 2011, 1:54:05 PM1/12/11
to tech...@gmail.com, albrec...@googlemail.com, gae2d...@googlegroups.com, re...@codereview.appspotmail.com
Just a few minor English corrections. Otherwise seems fine. I'll leave
it up to Andi as to whether he wants to include these sample files in
gae2django, although I don't see the harm.


http://codereview.appspot.com/3760048/diff/1/README
File README (right):

http://codereview.appspot.com/3760048/diff/1/README#newcode83
README:83: The preferred method to deploy Django applications is to WSGI
supporting
to ? WSGI

Also, I've read all over that the runserver thing is not preferred.
However I've been using it in an internal environment for ~6 months.
Seems fine.

http://codereview.appspot.com/3760048/diff/1/README#newcode88
README:88: only in development mode. For running Rietveld in production
environment, you
in _a_ production env

http://codereview.appspot.com/3760048/diff/1/README#newcode89
README:89: need to setup your web-server to serve /static/ alias
directly.
to serve _the_ /static/ alias

http://codereview.appspot.com/3760048/diff/1/README#newcode93
README:93: You may want to take a look at example configuration for
running Rietveld with
take a look at _the_ example config

http://codereview.appspot.com/3760048/

tech...@gmail.com

unread,
Jan 12, 2011, 2:16:04 PM1/12/11
to albrec...@googlemail.com, ibmi...@gmail.com, gae2d...@googlegroups.com, re...@codereview.appspotmail.com
Reviewers: Andi Albrecht, Ilia Mirkin,

Message:
Uploaded new patch set, this time it also includes information about
adding users.

http://codereview.appspot.com/3760048/diff/1/README#newcode83
README:83: The preferred method to deploy Django applications is to WSGI
supporting

On 2011/01/12 18:54:05, Ilia Mirkin wrote:
> to ? WSGI

Deploy to server. No? Deploy on WSGI supporting server?

> Also, I've read all over that the runserver thing is not preferred.
However I've
> been using it in an internal environment for ~6 months. Seems fine.

These advices were given from security point of view. I didn't bother
myself with Apache configs if I were in internal environment too.

http://codereview.appspot.com/3760048/diff/1/README#newcode93
README:93: You may want to take a look at example configuration for
running Rietveld with

On 2011/01/12 18:54:05, Ilia Mirkin wrote:
> take a look at _the_ example config

Got any article about articles? I've got a feeling that I need a fix. =)

Description:
Patch for Rietveld example running standalone with gae2django

Please review this at http://codereview.appspot.com/3760048/

Affected files:
M README
A apache.conf.example
A codereview.wsgi.example
M patches/upload.diff


Index: apache.conf.example
===================================================================
--- apache.conf.example (revision 0)
+++ apache.conf.example (revision 0)
@@ -0,0 +1,19 @@
+<VirtualHost *:80>
+ ServerName codereview.example.com
+
+ # Logs
+ ErrorLog /var/rietveld/log/error.log
+ CustomLog /var/rietveld/log/access.log combined
+ LogLevel notice
+
+ # Django gives out static resources only in development mode
+ # Setting up static/ resource serving
+ Alias /static /var/rietveld/static
+ Alias /media /var/rietveld/django/contrib/admin/media
+
+ WSGIDaemonProcess codereview threads=5 user=codereview umask=0026
home=/var/rietveld display-name=wsgi:rietveld
+ WSGIProcessGroup codereview
+
+ WSGIScriptAlias / /var/rietveld/codereview.wsgi
+</VirtualHost>
+
Index: patches/upload.diff
===================================================================
--- patches/upload.diff (revision 155)
+++ patches/upload.diff (working copy)
@@ -1,6 +1,6 @@
--- upload.py.orig 2010-09-30 09:57:13.552607000 +0200
+++ upload.py 2010-10-05 14:34:19.193893001 +0200
-@@ -285,7 +285,7 @@
+@@ -290,7 +290,7 @@
response.headers, response.fp)
self.authenticated = True

@@ -9,7 +9,7 @@
"""Authenticates the user.

The authentication process works as follows:
-@@ -362,8 +362,10 @@
+@@ -367,8 +367,10 @@
"""
# TODO: Don't require authentication. Let the server say
# whether it is necessary.
@@ -22,7 +22,7 @@

old_timeout = socket.getdefaulttimeout()
socket.setdefaulttimeout(timeout)
-@@ -402,9 +404,42 @@
+@@ -412,9 +414,42 @@
class HttpRpcServer(AbstractRpcServer):
"""Provides a simplified RPC-style interface for HTTP requests."""

Index: README
===================================================================
--- README (revision 155)
+++ README (working copy)
@@ -50,15 +50,15 @@

Note: Rietveld requires Django 1.1!

- svn co
http://code.djangoproject.com/svn/django/tags/releases/1.1.2/django django
+ svn co
http://code.djangoproject.com/svn/django/tags/releases/1.1.3/django django
svn co http://django-gae2django.googlecode.com/svn/trunk/gae2django

Then check out Rietveld by running

- svn co http://rietveld.googlecode.com/svn/trunk/codereview
- svn co http://rietveld.googlecode.com/svn/trunk/static
- svn co http://rietveld.googlecode.com/svn/trunk/templates
- svn export http://rietveld.googlecode.com/svn/trunk/upload.py
+ svn co http://rietveld.googlecode.com/svn/trunk/codereview
+ svn co http://rietveld.googlecode.com/svn/trunk/static
+ svn co http://rietveld.googlecode.com/svn/trunk/templates
+ svn export http://rietveld.googlecode.com/svn/trunk/upload.py


Then modify your checked out version of Rietveld by applying all patches
@@ -71,3 +71,31 @@
./manage.py syncdb

to initialize the example database.
+
+ ./manage.py runserver 127.0.0.1:8000
+
+will run Rietveld in development mode.
+
+
+Production Deployment
+=====================
+
+The preferred method to deploy Django applications is to WSGI supporting
+web server. You may copy codereview.wsgi.example and edit it to change
+/var/rietveld path to point to your installation.
+
+There is one important thing to remember. Django serves media (static)
files
+only in development mode. For running Rietveld in a production environment,
+you need to setup your web-server to serve the /static/ alias directly.
+
+http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#serving-media-files
+
+You may want to take a look at the example configuration for running
Rietveld
+with Apache using modwsgi in apache.conf.example
+
+
+Adding Users
+============
+
+Go to /admin URL and login as a super user. Users may change password by
+going to /admin/password_change URL.
Index: codereview.wsgi.example
===================================================================
--- codereview.wsgi.example (revision 0)
+++ codereview.wsgi.example (revision 0)
@@ -0,0 +1,11 @@
+import os
+import sys
+
+sys.path.append('/var/rietveld')
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+
+import gae2django
+gae2django.install()
+
+import django.core.handlers.wsgi
+application = django.core.handlers.wsgi.WSGIHandler()


Ilia Mirkin

unread,
Jan 12, 2011, 2:29:17 PM1/12/11
to gae2d...@googlegroups.com, albrec...@googlemail.com, re...@codereview.appspotmail.com
On Wed, Jan 12, 2011 at 2:16 PM, <tech...@gmail.com> wrote:
> Reviewers: Andi Albrecht, Ilia Mirkin,
>
> Message:
> Uploaded new patch set, this time it also includes information about
> adding users.
>
>
> http://codereview.appspot.com/3760048/diff/1/README
> File README (right):
>
> http://codereview.appspot.com/3760048/diff/1/README#newcode83
> README:83: The preferred method to deploy Django applications is to WSGI
> supporting
> On 2011/01/12 18:54:05, Ilia Mirkin wrote:
>>
>> to ? WSGI
>
> Deploy to server. No? Deploy on WSGI supporting server?

I was just pointing out that a word was missing. Perhaps "to use a WSGI ..."

> Got any article about articles? I've got a feeling that I need a fix. =)

I assume your native tongue is Russian. English has concepts that
Russian does not (and probably even more vice-versa). In this case,
there are three situations: use a definite article ("the"), use an
indefinite article ("a"), and use no article. See
http://esl.about.com/od/thebasics/a/a_an_the.htm for some examples.
But it's really rather hard to get it right... most people I know who
learn English as adults never end up getting it right. A lot of the
time it's just "feel" which is hard to quantify into rules.

But it's probably not as bad as counters in Japanese --
http://en.wikipedia.org/wiki/Japanese_counter_word#Full_list_of_counters
:)

--
Ilia Mirkin
imi...@alum.mit.edu

tech...@gmail.com

unread,
Jan 12, 2011, 4:22:09 PM1/12/11
to albrec...@googlemail.com, ibmi...@gmail.com, imi...@alum.mit.edu, gae2d...@googlegroups.com, re...@codereview.appspotmail.com

tech...@gmail.com

unread,
Jan 17, 2011, 10:22:48 AM1/17/11
to albrec...@googlemail.com, ibmi...@gmail.com, imi...@alum.mit.edu, gae2d...@googlegroups.com, re...@codereview.appspotmail.com
Andi, do you have time for review this week?

http://codereview.appspot.com/3760048/

albrec...@googlemail.com

unread,
Jan 17, 2011, 2:44:00 PM1/17/11
to tech...@gmail.com, ibmi...@gmail.com, imi...@alum.mit.edu, gae2d...@googlegroups.com, re...@codereview.appspotmail.com
[hehe, this review is on my todo list for today... :-)]

I've already had a quick look at it and I'm fine with it in general.

Ilia, thanks for having a close look at all this
grammar/wording/spelling stuff! Since I'm another non-native speaker I
really appreciate such (really helpful) comments! Feel free to commit it
if you don't have anymore comments.


http://codereview.appspot.com/3760048/diff/17001/README
File README (right):

http://codereview.appspot.com/3760048/diff/17001/README#newcode83


README:83: The preferred method to deploy Django applications is to WSGI
supporting

"is to WSGI supporting web server" sounds a bit strange. Wasn't there a
suggestion by Ilia in the first changeset?

http://codereview.appspot.com/3760048/diff/17001/README#newcode94
README:94: with Apache using modwsgi in apache.conf.example
Let's that the user and path (wsgi process group too?) in
apache.conf.example and codereview.wsgi.example should be reviewed
before running. Just to go for sure :)

http://codereview.appspot.com/3760048/

Reply all
Reply to author
Forward
0 new messages