Thursday, August 28, 2014

Unhandled Exception on first time deployment (works on home PC)

Hi, I'm new to Django. I been having a lot of fun developing it on my home computer, but I wanted to access it everywhere finally.

I followed this guide from my host, involving virtualenv and fastcgi. Python and Django were successfully installed and I can run Python commands and reference Django objects in SSH, but ...

I get Unhandled Exception is absolutely everywhere on my site, so something is wrong in the setup. Django is for sure installed.

Since deploying Django onto my site, the only difference from my development environment is:
- Django project name is different
- - ROOT_URLCONF and WSGI_APPLICATION updated to new project name
- - added my sites to ALLOWED_HOSTS (a solution attempt)
- - I turned debug mode off (as well as back on)
- - Added my only app to the list (also removed)

The only difference I can confirm for sure is that it is 1.6.6 vs 1.6.5 on my computer.

Tech support replied with this: 

(env) [~]# pip list | grep flashcards
flashcards (2.4)

What's interesting is the error now reports the following:

OSError: [Errno 2] No such file or directory: '/root/Documents/flashcards'
Content-Type: text/html

This seems to be some kind of configuration / script issue - please ask your web developer to review the above - it should reference your home directory (/home/tarikham).

I am inexperienced, but I can say for certain there is no reference to "Documents" in my app or Django project. I made a program with knowledge gained from the main Django tutorial.

I don't know where else to look or how to troubleshoot. Django has been so straightforward. There's, .htaccess, and the fcgi file. I'm going to post the .htaccess and fcgi. 

The only thing I can say that's weird about the .htaccess and dipsatch.fcgi is that they are placed in my /public_html/ folder, where as my Django code is in the root, which I heard you're supposed to do. I don't know what makes the "connection."

# Replaced my home folder (?) with "me"
# This is dispatch.fcgi


import sys
import os

sys.path.insert(0, '/home/me/.env/env/lib/python2.6/site-packages')

os.environ['DJANGO_SETTINGS_MODULE'] = 'tarikhamilton.settings'

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]

Thanks for reading this.

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment