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
- settings.py - ROOT_URLCONF and WSGI_APPLICATION updated to new project name
- settings.py - added my sites to ALLOWED_HOSTS (a solution attempt)
- settings.py - I turned debug mode off (as well as back on)
- settings.py - 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) me@me.com [~]# 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 settings.py, .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

#!/home/me/.env/env/bin/python

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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b95c964d-360c-41e4-b81e-59103a6bdef8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment