Lithonian Posted July 3, 2010 Posted July 3, 2010 I'm currently developing a site to be uploaded to my account on HelioHost; but before I become too attached to Django, I decided to try uploading a "Hello, world" first, to check it would work. I've created my application, and uploaded it to ~/public_html/django_test. I created ~/.python_egg_cache, and set its permissions to 777 (you might want to update your guide on the site? - 775 just caused permission errors). However, when I visit my site (http://lithonian.heliohost.org/django_test/), I receive a Python ImportError: CODEImportError at /django_test/dispatch.wsgi/No module named django_test.urls This is odd, because the Python path it reports is:CODE['/usr/lib/python2.4/site-packages/hashlib-20081119-py2.4-linux-x86_64.egg', '/usr/lib/python2.4/site-packages/elementtree-1.2.7_20070827_preview-py2.4.egg', '/usr/lib64/python24.zip', '/usr/lib64/python2.4', '/usr/lib64/python2.4/plat-linux2', '/usr/lib64/python2.4/lib-tk', '/usr/lib64/python2.4/lib-dynload', '/usr/lib64/python2.4/site-packages', '/usr/lib64/python2.4/site-packages/PIL', '/usr/lib64/python2.4/site-packages/gtk-2.0', '/usr/lib/python2.4/site-packages', '/home/lith/public_html/django_test'] And the file /home/lith/public_html/django_test/urls.py definitely exists. (Or so the file manager says... style_emoticons/default/biggrin.gif) I set up my .htaccess as so (and it seems to be working OK):CODERewriteEngine OnRewriteBase /RewriteRule ^(media/.*)$ - [L]RewriteRule ^(admin_media/.*)$ - [L]RewriteRule ^(dispatch\.wsgi/.*)$ - [L]RewriteRule ^(.*)$ /django_test/dispatch.wsgi/$1 [QSA,PT,L] My dispatch.wsgi looks like this:CODEimport os, sys ScriptRoot = "/home/lith/public_html/django_test" sys.path.append(ScriptRoot)os.chdir(ScriptRoot) # Just in case! Added after it didn't work os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'os.environ['PYTHON_EGG_CACHE'] = '/home/lith/.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) Just to highlight: my CPanel username is 'lith', and my subdomain is lithonian.heliohost.org.
Byron Posted July 3, 2010 Posted July 3, 2010 I just got this working with djbob's help yesterday: http://byrondallas.heliohost.org/djangotest/dispatch.wsgi Unzip this in your public_html directory and it will create a directory called 'djangotest' with all of the test files. Just make sure you change the paths. http://byrondallas.heliohost.org/djangotest.zip
Lithonian Posted July 4, 2010 Author Posted July 4, 2010 I just got this working with djbob's help yesterday: http://byrondallas.heliohost.org/djangotest/dispatch.wsgi Unzip this in your public_html directory and it will create a directory called 'djangotest' with all of the test files. Just make sure you change the paths. http://byrondallas.heliohost.org/djangotest.zip Thanks, that worked. Right now, my '^/?$' route doesn't match, understandably, because the URL is '/django_test/', however Django is using the "real" URL of '/django_test/dispatch.wsgi/'. Is there any way I can get it to match routes without the 'dispatch.wsgi'? (If I should ask this in Questions rather than here, tell me. )
Byron Posted July 4, 2010 Posted July 4, 2010 This support request is being escalated to our root admin.
Ashoat Posted July 4, 2010 Posted July 4, 2010 Unfortunately, I don't think there's a way around this
Lithonian Posted July 4, 2010 Author Posted July 4, 2010 Unfortunately, I don't think there's a way around this OK. That's fine. I'll try writing a wrapper around urlpatterns() that adds it for me, depending on a setting in settings.py, so I can use the same URLconf for Heliohost and my home machine. Thanks for your help.
Ashoat Posted July 5, 2010 Posted July 5, 2010 If you're willing to provide that wrapper for the rest of our users I could put it into our Django package
kruptein Posted July 5, 2010 Posted July 5, 2010 Wouldn't this be possible by adding this to .htaccess RewriteBase / RewriteRule ^$ projectname/ replace projectname with djangotest in this case [note].htaccess in public_html ----------------------------------------------- There is something very odd... I uploaded the zip of byron, and I got the message: Congrats it works! but then I saw that dispatch.wsgi was still pointing to byron so I changed byron to kruptein, and I refreshed my site and I got: "5OO Internal Server Error" So just changing byron to kruptein created an error, what is this?
Ashoat Posted July 5, 2010 Posted July 5, 2010 Did you follow the directions on the Python/Django page at our home page?
kruptein Posted July 5, 2010 Posted July 5, 2010 Yes I did, multiple times even because I really wanted to make sure everything was done, but I will check it again, I might forgot one thing when uploading byron's zip although I doubt that
Byron Posted July 5, 2010 Posted July 5, 2010 Yes I did, multiple times even because I really wanted to make sure everything was done, but I will check it again, I might forgot one thing when uploading byron's zip although I doubt that Did you chmod your .python_egg_cache directory to 777?
Byron Posted July 5, 2010 Posted July 5, 2010 Yes I did I'm not seeing the directory "djangotest" in your directory list. Did you change the name after you unzipped my zip? http://kruptools.heliohost.org/djangotest
Byron Posted July 6, 2010 Posted July 6, 2010 Yes I renamed it to dbug, sorry for that The zip should work fine. Try unzipping it without renaming the directory and only changing the path.
Recommended Posts