Monday, March 9, 2015

Getting 500 error on ASO

Hi Everyone,

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

https://docs.djangoproject.com/en/1.7/.

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

A Small Orange has this tutorial:

https://kb.asmallorange.com/customer/portal/articles/1603414-install-django-using-virtualenv

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

--
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/b97d7467-777d-4808-a447-8d71425bc8fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment