Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy a WordPress site and Django site on the same domain?

I'm a complete newbie when it comes to sysadmin/deployment. Here's what I'm hoping to accomplish:

  1. Have domain.com be a normal WordPress site.
  2. Have either domain.com/app or app.domain.com be a Django webapp.
  3. Hosting on Linode.
  4. Quick and easy updates of the Django webapp code.

From what I can tell, gunicorn is an elegant way to serve the Django webapp, while WordPress fits most naturally with Apache. Meanwhile, nginx is recommended as a proxy in front of gunicorn and also seems to be used to improve performance of WordPress sites.

So what I'm thinking is: use nginx as a proxy server that routes all incoming web requests to either gunicorn (for the Django wepapp) or Apache (for the WordPress site). The Linode host would be running nginx, gunicorn, and Apache simultaneously.

Meanwhile, for updates of the Django webapp, I can simply update to the latest version of the code via github.

Does all that make sense? Am I even understanding things conceptually correctly? Or barking up the wrong tree entirely? (For instance can/should I just use a single Apache server to route requests to either WordPress or the Django app based on URL?) What gotchas and issues should I keep in mind as I research how to get this running nice and smoothly?

UPDATE: I've side-stepped all of this by (1) using Heroku to host my Django app, (2) using a CNAME record to map app.domain.com to the Heroku-hosted Django app, and (3) leaving (for now) the WordPress site on its existing host at domain.com. Thankfully, after gaining great new respect for what sysadmins and db admins do as I investigated all this, now I can get back to coding!

like image 411
Ghopper21 Avatar asked Sep 14 '12 06:09

Ghopper21


People also ask

Can I host Django website on WordPress?

You must convert Django to WordPress considering that WordPress websites can scale to meet the growing needs of your business and more importantly are extremely easy to use and maintain. This isn't true for Django websites as their maintenance require a steep learning curve.

Can you host a website with Django?

Yes. Django has its own server for testing, but you'll need to install server software like Apache to use it on a live website.

Can I use Django in shared hosting?

This is one of the options that you can avail to deploy your Django project. The advantage of shared hosting is that it is cheap. The disadvantage is that you might not be able to deploy some advanced projects because you can not install a software on your shared host.


1 Answers

@Ghopper21

+1 for your question first.

Now, This is really interesting to know how it's possible in real time execution. I checked with some of my geek friends and I found tremendous response, here are some of suggestion with reference I got after brainstorming with them.

First of all check this link for deploying & running WP altogether with Django on Nginx +uWSGI...

These two threads of support forums from Webfaction.com gives you more idea about how they are recommending it to their client...

Deploying Django and Wordpress in same domain

wordpress + django on same account - advisable or not?

Hey, I got one support ref. of Stack Overflow itself, which is explaining how to achieve it on APACHE server...

How do I run Django and PHP together on one Apache server?

And last but not least, the one where a geek like us integrated WP with Django... Integrate WordPress and Django

like image 196
4 revs, 4 users 83% Avatar answered Oct 03 '22 23:10

4 revs, 4 users 83%