First time here? Check out the FAQ!

rfrankel's profile - activity

2016-03-08 16:00:30 -0500 received badge Notable Question (source)
2016-03-08 16:00:30 -0500 received badge Popular Question (source)
2013-05-28 17:29:10 -0500 received badge Nice Answer ( source )
2013-05-28 17:29:10 -0500 received badge Self-Learner ( source )
2013-05-28 17:28:13 -0500 received badge Nice Question (source)
2012-08-29 00:42:41 -0500 received badge Famous Question (source)
2012-06-21 15:52:50 -0500 received badge Famous Question (source)
2012-05-20 21:30:34 -0500 received badge Nice Question (source)
2012-05-07 18:47:42 -0500 received badge Notable Question (source)
2011-11-17 06:49:58 -0500 received badge Taxonomist
2010-12-06 04:16:37 -0500 received badge Popular Question (source)
2010-10-01 12:55:30 -0500 received badge Teacher ( source )
2010-10-01 12:55:30 -0500 received badge Student (source)
2010-10-01 12:54:10 -0500 received badge Supporter
2010-10-01 12:54:10 -0500 received badge Scholar ( source )
2010-10-01 12:54:09 -0500 received badge Editor (source)
2010-09-24 23:25:12 -0500 answered a question Serving from a subdirectory

I got this working by using nginx as a front-end proxy. Here's my nginx config:

upstream askbot {
        server  localhost:9000;
}

upstream wiki {
        server  localhost:9001;
}

server {
        listen 80;
        server_name xxxxx.members.linode.com;

        proxy_redirect  off;
        proxy_set_header        Host    $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

        location ~ ^/ask {
                access_log      /var/log/nginx/askbot_log;
                root /opt/webapps/ask/;
                proxy_pass  http://askbot;
        }


        location / {
                access_log      /var/log/nginx/wiki_log;
                root /opt/webapps/wiki/;
                rewrite ^/wiki/(.*) /$1;
                proxy_pass  http://wiki;
        }
}

The other thing I had to do was update urls.py:

urlpatterns = patterns('',
    (r'%s' % settings.ASKBOT_URL, include('askbot.urls')),
    (r'^ask/admin/', include(admin.site.urls)),
    #(r'^cache/', include('keyedcache.urls')), - broken views disable for now
    (r'^ask/settings/', include('askbot.deps.livesettings.urls')),
    (r'^ask/robots.txt$', include('robots.urls')),
)

And, as you suggested, I removed the ASKBOT_MEDIA_URL setting.

For completeness, here's my apache config:

<VirtualHost localhost:9000>
     ServerAdmin xxxxxxxxx
     DocumentRoot /opt/webapps/ask/
     ServerName xxxxxxxx

     #aliases to serve static media directly
     #will probably need adjustment
     Alias /ask/m/ /usr/local/lib/python2.6/dist-packages/askbot-0.6.11-py2.6.egg/askbot/skins/
     Alias /ask/upfiles/ /opt/webapps/ask/askbot/upfiles/
     Alias /ask/admin/media/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/

     <DirectoryMatch "/opt/webapps/ask/askbot/skins/([^/]+)/media">
        Order deny,allow
        Allow from all
     </DirectoryMatch>
     <Directory "/opt/webapps/ask/askbot/upfiles">
        Order deny,allow
        Allow from all
     </Directory>

     #must be a distinct name within your apache configuration
     WSGIDaemonProcess askbot2
     WSGIProcessGroup askbot2
     WSGIScriptAlias / /opt/webapps/ask/django.wsgi
     #make all admin stuff except media go through secure connection
     #<LocationMatch "/admin(?!/media)">
     #    RewriteEngine on
     #    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
     #</LocationMatch>
     CustomLog /var/log/apache2/askbot/access_log common
     ErrorLog /var/log/apache2/askbot/error_log
     LogLevel debug

</VirtualHost>

Thanks again for the support. :)

2010-09-24 22:17:12 -0500 commented question Serving from a subdirectory
I was using WikkaWiki, though I may switch to MediaWiki.
2010-09-23 01:54:11 -0500 commented question Serving from a subdirectory
No rush. :) Like I said, if I change ASKBOT_URL and make the WSGIScriptAlias for / then all other directories, e.g. /wiki/, get handled by Django. I'm trying to avoid that. The complicated solution is nginx as a reverse proxy...if you can't think of another solution, I'll try that. Thanks!
2010-09-23 01:36:10 -0500 commented question Serving from a subdirectory
I should clarify that logging in and out does work, people just get taken to the wrong URL once they've done it.
2010-09-23 01:22:12 -0500 commented answer Can't moderate more than 16 bits of karma?
Got it - I'll make sure to put (potential) bugs there and restrict this to things like installation and documentation issues. Thanks again for the help.
2010-09-23 01:21:26 -0500 marked best answer Can't moderate more than 16 bits of karma?

Repute model uses SmallInteger field which in MySQL is in range –32768 to 32767. The user reputation is UnsignedInteger with a much larger range and apparently there is no check on the limits in the code, I've saved this issue in the bug tracker. Thanks.

edit: btw bug tracker is at http://bugs.askbot.org

2010-09-23 01:11:57 -0500 asked a question Serving from a subdirectory

Okay, I'm making a lot of progress. I want to serve Askbot from mysite.com/ask/, and furthermore, I don't want mysite.com/ being handled by WSGI/Django. As far as I can tell, that means I need to have e.g. WSGIScriptAlias /ask ..., as opposed to WSGIScriptAlias / .... Specifically, when I had ASKBOT_URL = 'ask/' and WSGIScriptAlias / ..., mysite.com/wiki/ was getting handled by Django.

I pretty much have it working how I want, after doing the following:

  • Leave ASKBOT_URL as ''
  • In settings.py, set ASKBOT_MEDIA_URL = 'ask/'
  • In askbot/skins/utils.py, in get_media_url, have it use ASKBOT_MEDIA_URL instead of ASKBOT_URL
  • In the apache config, change the aliases given from e.g. /upfiles/ to /ask/upfiles/

Everything seems to work, except that logging in and logging out takes people to /, not /ask/.

The question: What's the right way to fix this? Am I going about the subdirectory thing all wrong?

Here's the relevant part of my apache config:

#replace with 127.0.0.1 with real IP address
<VirtualHost 123.345.567.789:80>
     ServerAdmin admin@mysite.com
     DocumentURL /opt/webapps/
     ServerName mysite.com

     #aliases to serve static media directly
     #will probably need adjustment
     Alias /ask/m/ /usr/local/lib/python2.6/dist-packages/askbot-0.6.11-py2.6.egg/askbot/skins/
     Alias /ask/upfiles/ /opt/webapps/ask/askbot/upfiles/
     Alias /ask/admin/media/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/


     <DirectoryMatch "/opt/webapps/ask/askbot/skins/([^/]+)/media">
        Order deny,allow
        Allow from all
     </DirectoryMatch>
     <Directory "/opt/webapps/ask/askbot/upfiles">
        Order deny,allow
        Allow from all
     </Directory>

     #must be a distinct name within your apache configuration
     WSGIDaemonProcess askbot2
     WSGIProcessGroup askbot2
     WSGIScriptAlias /ask /opt/webapps/ask/django.wsgi
     #make all admin stuff except media go through secure connection
     #<LocationMatch "/admin(?!/media)">
     #    RewriteEngine on
     #    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
     #</LocationMatch>
     CustomLog /var/log/apache2/askbot/access_log common
     ErrorLog /var/log/apache2/askbot/error_log
     LogLevel debug

</VirtualHost>
2010-09-22 18:02:05 -0500 asked a question Can't moderate more than 16 bits of karma?

I tried giving myself a million karma and got a warning - adding the actual karma worked, but the moderation record complained; the repute object got stored with 32767 for positive and 1000001 for karma.

Does this mean the model field should be changed (assuming you agree this is a bug)?

2010-09-22 17:38:47 -0500 commented answer New install, exception when registering
Thanks, updating settings.py fixed the problem!
2010-09-22 17:38:26 -0500 marked best answer New install, exception when registering

I'm guessing that your django_authopenid has not been migrated - my fault - have not updated the instructions.

Try (in addition):

python manage.py migrate django_authopenid

edit: this solves the problem, please make AUTHENTICATION_BACKENDS in settings.py look this way:

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'askbot.deps.django_authopenid.backends.AuthBackend',
)

I forgot to update that in the settings.py template. You get 50 rep bonus for reporting this annoying issue :).

2010-09-22 17:10:13 -0500 commented answer New install, exception when registering
Don't mind at all - thanks for your time!
2010-09-22 17:04:42 -0500 commented answer New install, exception when registering
I don't understand the difference between your answer and your comment, but I had already done `python manage.py migrate django_authopenid` before having the problem. I just ran it again, to make sure, and yep - didn't help.
2010-09-22 16:50:45 -0500 asked a question New install, exception when registering

I deployed the site, it shows up as expected on a development server (i.e. manage.py runserver), but when I try to register with Google or Yahoo! I get the following traceback. I do have python-openid installed, I did not create a Django superuser on the first syncdb, I ran the necessary South migrations, and (I believe) I followed all the other instructions.

Environment:

Request Method: POST
Request URL: http://li234-101.members.linode.com/account/register/
Django Version: 1.1.2
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.humanize',
 'django.contrib.sitemaps',
 'askbot',
 'askbot.deps.django_authopenid',
 'south',
 'askbot.deps.livesettings',
 'keyedcache',
 'robots']
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
 'askbot.middleware.cancel.CancelActionMiddleware',
 'askbot.deps.recaptcha_django.middleware.ReCaptchaMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'askbot.middleware.view_log.ViewLogMiddleware',
 'askbot.middleware.spaceless.SpacelessMiddleware')


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
  99.                     response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/askbot-0.6.11-py2.6.egg/askbot/deps/django_authopenid/views.py" in decorated
  218.         return func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/askbot-0.6.11-py2.6.egg/askbot/deps/django_authopenid/views.py" in register
  772.                 raise Exception('this does not make any sense')

Exception Type: Exception at /account/register/
Exception Value: this does not make any sense