Django domain alias in local development environment

Recently, while working on a new Django project I need to create two Django sites that referred to each other. One would be the main domain i.e. mysite.com and the other would be a subdomain i.e. hello.mysite.com. So I started wondering if there was a way to test this locally in my development environment, and after 2 days of searching online I really found nothing and started to think it was impossible.

However, after speaking with a good friend of mine, Chaz Hill, who happens to be a really kick-ass System Administrator he pointed me in the right direction. I was trying to do all this with Vagrant at the time but in this post I’ll show you how you can do it the normal way, through the shell.

Create your Django project and app, then launch the Django development server using port 80, this is the important part (even though I’ve been using Django for sometime now, it totally slipped my mine I could set the port to 80). Now if you tried running this without sudo – you will get an permissions error, the fix of course is to do this => sudo python manage.py runserver 127.0.0.1:80 

Pic of Django development server running in shell and in the foreground the hosts file.

Pic of Django development server running in shell and in the foreground the hosts file.

With the Django development server running, open your hosts file, /etc/hosts and add 120.0.0.1 mysite.com – save the file and goto your browser and type mysite.com, you’ll happily see your Django site running 🙂

Paranoia

The other day while I was listening to some music (Hip-Hop and Dancehall) on the radio. I started to notice a particular theme to the music that I never realized before. It seems a lot of popular music has a lot of paranoia.

I do feel a lot of music in Caribbean has a lot of under-tones of, “dem a wicked people”, “jealousy”, “friend against friend” and “don’t trust anyone” messages. I’m not sure if there is any correlation between listening to this type of music and Caribbean people’s feelings regarding their trust issues and the treatment they feel in their own communities.

I was going to just generalise and say that Caribbean music was the only offenders of this point, but I did notice it in other music originating outside of the Caribbean region. In conclusion, I don’t think music can force you to act a certain way, but it can add influence to those that are easily influenced.

Finally

Finally tackling cleaning up my blog. Went for the default TwentyTwelve theme that comes with WordPress. I might “design” it later, but for right now I want to focus on building cool projects vs designing my blog. Plus with this cleaner version, it puts the emphasise on the content and not the design.