Hammad Hammad - 3 months ago 57
Apache Configuration Question

Django on godaddy - 500 internal server error OR Forbidden 403

I have a deluxe Linux hosting account on Godaddy and from the past 3 days I've been trying to host a Django website.

I followed these tutorials:

http://www.lichun.cc/blog/2012/06/setup-django-1-4-on-godaddy-linux-economy-host/

Installing a django site on GoDaddy

http://blurback.com/post/563604002/running-django-on-godaddy-sigh

But I'm getting this:


Forbidden

You don't have permission to access / on this server.

Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.

Apache Server at www.gccfishing.com Port 80


I think the problem is with the python path which is written at the first line in files:
#!/usr/local/bin/python2.7
, because when I try to execute a file in SSH I get this error:

-bash: ./test.py: /usr/local/bin/python2.7^M: bad interpreter: No such file or directory.


where test.py is a sample test file and it's chmoded.

This is my folder configuration on godaddy:

home
content
88
10907688
.pip
data
error_logs
html
lib
scctmp
tmp


In
html
I'm placing files according to the above mentioned tutorials which are either dispatch.py or .cgi files.

In
lib
I have the following:

venv
bin
gccFishing (this is the Django project)
MySQLdb
python ( file type: File)
python2.7 ( file type: 7 File)
django-admin.py
acitvate_this.py
include
shortcut folder of python2.7
lib
python2.7
shortcuts to all python libraries
site-packages(this is where I downloaded Django)


Any idea what's happening here?

Which files does Apache execute first?

Should I use dispatch.py or dispatch.cgi?

Any help/comments will be very helpful. Thank you.

Answer

It looks like your line:

#!/usr/local/bin/python2.7

was made in windows, then uploaded.

-bash: ./test.py: /usr/local/bin/python2.7^M: bad interpreter: No such file or directory.

It contains the ^M, which is a windows newline character. Try editing in VIM on the server and you will see them. Convert to UNIX text file.

Be sure when you edit text files on windows that you save them in UNIX format if you are uploading to a linux server.

Comments