Redirecting a WordPress blog using Django on Heroku

I have a Django app running on Heroku, and I’d like to add a WordPress blog to it. After some background reading, it seems like the accepted solution for Rails is:

  1. Deploy a separate Heroku WordPress app solely for your blog
  2. Use rack-reverse-proxy to redirect mydomain.com/blog to myblog.herokuapp.com

However I have not found an equivalent reverse proxy middleware solution for Django. Does one exist? If not, how would I go about rolling my own?

Related posts

Leave a Reply

1 comment

  1. You don’t need a reverse proxy just to do a redirect. Just use a view.

    Create a view:

    def blog(request, *args, **kwargs):
        from django.shortcuts import redirect
        return redirect('http://myblog.herokuapp.com')
    

    Attach view to a url in your urls.py file:

    urlpatterns = patterns('',
        url(r'^blog', blog, name='blog_redirect'),
    )