Jump to content

Recommended Posts

Posted
Hi, I am using Python with Django. I am new to it and I am learning it.

I followed the instructions on the page for Python/Django. I started a small project (for now). The thing is, I used the server that came with Django on my computer, and my project works. When I move it on to HelioHost, it doesn't work. I put the project folder under /public_html/ and have the .htaccess and the dispatch.wsgi in the project folder with the right permissions. Going to my website, http://<website>/<projectfolder> brings up the code of dispatch.wsgi. http://<website>/ gives a directory of /public_html/ because I haven't set up an index page yet (I set Django to provide a page when http://<website>/ is requested).

The Django files are .py, should they be .pyc?

Am I forgetting to do something (like starting up Django, if there is such a thing), am I doing something wrong, or what?

I have been unable to get Django working correctly. I have a small project that works on my local PC, with the Django. In addition I have followed the tutorial on www.helihost.org to the tee

http://www.heliohost.org/home/features-mai...tingmenu/python

 

When I try to access the folder with the django project in the content of dispatch.wsgi is displayed. I have checked and rechecked the permissions for my .htaccess and dispatch.wsgi files, and they are correct. To me it seems like mod_wsgi is not loading the project correctly. If it loading correctly and I had errors in my Django project I except I would at least get some Django debugging output.

 

I have found this thread which is pretty much the same problem as I seem to be having:

http://www.helionet.org/index/index.php?sh...aded&start=

But I am still unable to resolve the problem

 

The things I am unsure about are:

The permissions for the .py files in the project folder

I am using SQlite3, what should the permissions be of the SQLite file?

Do I need to specify the python path anywhere (#!/usr/bin/python)?

 

Thanks for the awesome hosting by the way!!!!

 

Posted

You shouldn't give people your password. I checked the Apache error_log, and I'm getting the following error message for your site:

 

"No module named DjangoSite1"

 

Are you sure this problem isn't coming up from your end?

Posted

The only reason I asked if you needed my password was because of something I read in that other thread that I referred to in my first post.

 

When accessing my site I no longer get the dispatch.wsgi displayed, instead I get a 500 internal server error. So based on that I assume something in the system changed.

 

There are probably some other problems in the site, this is the first Django site I am trying to deploy. I checked the error log in cPanel and I don't get any logs referring to DjangoSite1. So I am not sure how that error log correlates with the Apache error_log. Here is the error log for the site:

 

[Mon Jul 20 01:17:12 2009] [error] [client 41.145.144.48] File does not exist: /home/renier/public_html/500.shtml, referer: http://www.fficourses.heliohost.org/

[Mon Jul 20 01:17:12 2009] [error] [client 41.145.144.48] File "/home/renier/public_html/DjangoSite1/dispatch.wsgi", line 9, in application, referer: http://www.fficourses.heliohost.org/

[Mon Jul 20 01:17:12 2009] [error] [client 41.145.144.48] mod_wsgi (pid=13024): Exception occurred processing WSGI script '/home/renier/public_html/DjangoSite1/dispatch.wsgi'., referer: http://www.fficourses.heliohost.org/

[sun Jul 19 23:17:11 2009] [error] [client 41.145.144.48] File does not exist: /home/renier/public_html/404.shtml

[sun Jul 19 23:17:11 2009] [error] [client 41.145.144.48] File does not exist: /home/renier/public_html/favicon.ico

 

How do I access the apache log?

Posted

You can't access the Apache error_log, as it has information in relation to all accounts. cPanel's error_log is the excerpt of Apache's error_log pertaining to your site, but sometimes it misses some stuff.

 

I'll look into this problem when I get home.

Posted

Well I have made quite a lot of progress. I put on another test application (mysite), only much more basic. Got it to display the basic "It works" Django page. Then I proceeded to add the admin app and added a sqlite3 db file, and sorted out the urls required for this. I am now getting another internal server error, when I attempt to go to the admin section of the test site. The db file was created on my local machine.

 

The error log in cPanel is not really giving me anything useful. Could you maybe check if there is anything relevant in the Apache log?

I think the error could be because the permissions of my database file are incorrect. I am running it as 777 for now.

 

 

Posted

Hello ren,

I tried to deploy a small application 'mysite' whithout sqlite and templates but I got an internal server error

Can you show me your .htaccess and dispatch.wsgi (I have followed the instructions on the site but perhaps I have maked some mistakes)

 

Thank you

Ruggero

 

 

 

Posted

Here is my dispatch.wsgi

 

import os, sys

sys.path.append("/home/renier/public_html/mysite");

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

os.environ['PYTHON_EGG_CACHE'] = '/home/renier/.python_egg_cache'

import django.core.handlers.wsgi

_application = django.core.handlers.wsgi.WSGIHandler()

def application(environ, start_response):

environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO']

return _application(environ, start_response)

 

and the .htacess

 

RewriteEngine On

RewriteBase /

RewriteRule ^(media/.*)$ - [L]

RewriteRule ^(admin_media/.*)$ - [L]

RewriteRule ^(dispatch\.wsgi/.*)$ - [L]

RewriteRule ^(.*)$ mysite/dispatch.wsgi/$1 [QSA,PT,L]

 

What I have deduced from setting up the mysite application is that if you get internal server errors then, there is probably something wrong with the way your Django application is being called. What I can suggest though I am sure you would have covered this as well is the following:

Check the file permissions are correct as specified in the tutorial

Check that your ROOT_URLCONF = 'urls', the default would be ROOT_URLCONF = 'mysite.urls'

You could try checking your error log, though this is not always that helpful, djbob said he would look into it

 

Posted

Make sure to post any fix or PM discussion you guys have had publicly! In case somebody else has similar issues, I'd like to be able to assist them. Additionally, I'd like to correct the main HelioHost page to display the correct fix.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...