Jump to content

Recommended Posts

Posted

I have finally been able to make my hello-world django-app run. But this is only running when the project package is removed everywhere:

in settings.py:

ROOT_URLCONF = 'urls'

instead of 'PROJECT-NAME.urls', which I use in the development side.

also in the urls.py, all the referred classes require to have the project package removed.

 

I'm sure it must be possible to use the project package, too!?!

 

Could anyone point me to where this might be changed?

Posted

dispatch.wsgi:

import os, sys
sys.path.append("/home/agon/public_html/udb");
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['PYTHON_EGG_CACHE'] = '/home/agon/.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']	# Line X
return _application(environ, start_response)

If I have it like this, the urls from

ROOT_URLCONF = 'udb.urls'

cannot be found.

If this value is changed to

ROOT_URLCONF = 'urls'

then the page can't be found (404).

 

In this thread, kuloto points out that it was helpful to comment out the "Line X" (see above).

If I do this using

ROOT_URLCONF = 'udb.urls'

then again the udb.urls cannot be found.

When using

ROOT_URLCONF = 'urls'

I have to remove the "udb" package from the classes/functions inside urls.py and THEN it works.

(otherwise I'll get a ViewDoesNotExist inside urls.py). But as I wrote in the previous post, I would like

to keep the base/project package 'udb'.

 

I hope this helps.

Posted

Change your dispatch.wsgi to this:

 

import os, sys
sys.path.append("/home/agon/public_html/udb");
sys.path.append("/home/agon/public_html");
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['PYTHON_EGG_CACHE'] = '/home/agon/.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']    # Line X
    return _application(environ, start_response)

Posted

Greatness! It works, but I still have to have the Line X commented out.

Otherwise it will give a "Page not found" (404) error.

 

I'm happy enough though.

Many thanks.

 

(May be marked [solved])

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...