Jump to content

[SOLVED]Django Base/project Package Not Allowed


Carl A.

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...