Getting 500 error on ASO

59 views
Skip to first unread message

mfox_chi

unread,
Mar 9, 2015, 9:57:47 PM3/9/15
to django...@googlegroups.com
Hi Everyone,

I've been working on learning Django the past few months and have been following the django tutorials here:


I've followed the tutorial on my local machine in addition to on my A Small Orange account.

A Small Orange has this tutorial:


which has gotten me to reach the default django "Congrats" webpage. This pages appears on both my local machines django setup and the ASO website. The next step is to run the startapp function within the mysite folder.

My folder structure is as follows on the ASO server

home/"username"/
       website/
                  mysite/ 
                            polls/ (after I run the startapp command)
                                   (all the startapp default files)     
                            mysite/
                                     (all the startproject default files)
      public_html/
                  dispatch.fcgi
                  .htaccess

My issue is that when I run "python27 manage.py startapp polls" from within the website/mysite folder my server immediately goes to a 500 internal server error page online while this function causes no issues on my local computer.

The only lead I have on the problem currently is that when I run my dispatch.fcgi file via "python27 dispatch.fcgi" from within the public_html directory I get the HTML output that should be up on my website. The output is shown within my SSH. This makes me think the error has something to do with the communication between the .htaccess file and the dispatch file. 

-dispatch.fcgi 

from traceback import formate_exc
try:
#!/home#/theopeni/.env/env/bin/python

     import sys
     import os

     sys.path.insert(0, "/home/(myusername)/.env/env/lib/python2.7/site-packages")
     sys.path.append("/home/(my username)/website/mysite/mysite")

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

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

except Exception:
    open("/home/(my username)/website/error.txt", "w").write(format_exc())
    raise

-.htaccess

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

I've talked to the ASO customer support and I worked with a technical support person for about a week to solve it and they were able to get an app started without error but then told me that this was beyond the scope of their customer support. I then tried adding my own app with the python27 manage.py startapp command and it broke the website again. 

Has anyone else encountered this problem?

Thank you!

Michael

Collin Anderson

unread,
Mar 11, 2015, 2:49:14 PM3/11/15
to django...@googlegroups.com
Hi Michael,

Are you checking your Apache log? Also, be sure to set up ADMINS so you can get emails for any django errors.

I believe runfastcgi is gone from django now, along with all of django.core.servers.fastcgi.

At work we used to host on ASO too. We now use Linode. Digital Ocean is good too.

Collin

Jack Maxwell

unread,
Dec 13, 2015, 9:34:05 AM12/13/15
to Django users
I've got the same problem to configure my Shared Host on QHoster, using fastCGI.

I didn't find a valid tutorial so far.

my config:
/home/username/
        |---- /public_html/.htaccess
        |                       /index.fcgi
        |-----/mydjangoVirtualEnv
        |-----/MyDjangoProject_SRC
                  |----manage.py
                  |----MyDjangoProject
                              |--settings.py

My .htaccess :
AddHandler fcgi-script .fcgi
RewriteEngine On
RewriteCon %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]

My index.fcgi:
#!/home/username/djangoenv/bin/python
import sys
import os

sys.path.insert(0, "/home/username/djangoenv/lib/python3.4/site-packages")
sys.path.append("/home/username/MyDjangoProject_SRC/MyDjangoProject")

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


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

When I go to my home page, I get a 500 error.
The log from cPanel only displays:
MY_IP - - [13/Dec/2015:09:34:29 +0000] "GET / HTTP/1.0" 500 - "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0"


Any help or even a little suggestions welcome! I can go nowhere from here after days of searching...

Reply all
Reply to author
Forward
0 new messages