python – How can domain aliases be set up using Django? – Education Career Blog

I am working on creating a website in Django which consists of two parts: the website itself, and the forum. They will both be on separate domains, i.e. and How can this be done in Django, when the forum and main site are part of the same instance?


This is done at the web server level. Django doesn’t care about the domain on the incoming request.

If you are using Apache just put multiple ServerAlias directives inside your virtual host like this:

<VirtualHost *:80>
    ... other directives as needed ...

This tells Apache to direct requests for all of those domains into the same instance.

For nginx your config file would look something like:

server {
    listen 80;
    ... other directives as needed ...

Leave a Comment