Python – How to set-up Django 1.11 with python 3.4 on Bluehost


I am a novice with django, but have completed the length tutorial and gotten to the point, where at least locally, I can make some cool things.

I now want to deploy these things… the problem is that I am not exactly an expert with knowing how the web works or how to deploy things.

So I got an account with and did a google on how to install django on bluehost. It is a bit old and outdated.

But I followed it (installing python 3.4 instead of python2.7)

I think python 3.4, pip and django are all installed correctly? (I can run python3 -V, etc)

and then I get to some voodoo

mkdir ~/public_html/myproject
cd ~/public_html/myproject

cat > myproject.fcgi << EOF
import sys, os
project_name = "myproject"

# Add a custom Python path.
sys.path.insert(0, os.path.expanduser("~") + "/python27")
sys.path.insert(13, os.getcwd() + "/" + project_name)

os.environ&#91;'DJANGO_SETTINGS_MODULE'&#93; = project_name + '.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

cat > .htaccess << EOF
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ myproject.fcgi/$1 &#91;QSA,L&#93;

chmod 0755 myproject.fcgi


<h3><span style="color: #800000;">Step 4: Create the Django Project</span></h3>
<p>Lastly, we're going to use django-admin to start our project called 'myproject' making sure to be in the correct directory first:</p>
cd ~/public_html/myproject/ startproject myproject

which I follow, because it doesn't seem malicious and I go to my site and get an error 500.

So there are a few things going on here:

  1. I don't know enough to solve this myself
  2. Something I did (or the code above) isn't correct (maybe I need wsgi instead of fastcgi – not that I know what either means)

So please instead of just downvoting or voting to close this (or at the very least in addition to) could you provide some links to easily accessible resources to understand what all of the jargon is and what it means etc / how to over come this hurdle.


Best Answer

Django deprecated fcgi support in version 1.9 for some reason. If you downgrade to version 1.8.11 (still supported until at least April 2018) you may have more luck. I'm also trying to see if there's a way to upgrade past 1.8.11 without switching hosts, but for now 1.8.11 is an acceptable option since it includes the latest security update.

For >=1.9 it seems you have to use mod_wsgi instead of fcgi and bluehost either doesn't allow it or it is very difficult to get working.

Check out You can see that 1.8 has extended support because of this.

Related Topic