This is going to be a short and technical post about deploying two or more Django applications on the same server, so that 'http://yourdomain.com/' and 'http://yourdomain.com/otherapp' access two different Django projects.
This assumes that you are using Apache and mod_wsgi to deploy your Django applications. The best guide I've found for doing that is here at Punteney.com.
The basic concept is really simple here, you just need to register a different WSGIScriptAlias for each project you're hosting in your sites-available file.
So, your set up might look something like this:
WSGIScriptAlias /app2 /var/www/app2/app2/django.wsgi <Directory /var/www/app2/app2> Order allow,deny Allow from all </Directory> WSGIScriptAlias / /var/www/app1/app1/django.wsgi <Directory /var/www/app1/app1> Order allow,deny Allow from all </Directory>
This would make http://yourdomain.com/app2 call app2 and http://yourdomain.com/ call app1. It's important that you put the project which has the suffix BEFORE the one which doesn't, or it else it won't work. Then just call sudo service apache2 restart and test it out. Hopes this helps!
We match top developers with high-quality freelance and full-time jobs. Post a job.
Pssst.. do you want to write for gun.io? Or, do you have a blog you'd like to see syndicated here?
Get in touch email@example.com.