List Info

Thread: Re: differences between runserver and apache




Re: differences between runserver and apache
country flaguser name
United States
2008-01-21 12:26:32
James Bennett wrote:
> On Jan 21, 2008 8:43 AM, Carl Karsten <carlpersonnelware.com> wrote:
>> Exception Type: ViewDoesNotExist at /admin/
>> Exception Value: Tried new_message in module
ridgemoor.core.views. Error was:
>> 'module' object has no attribute 'new_message'
> 
> Most likely is that something that's different between
your Python
> path under runserver and under Apache is causing
something to fail
> with an ImportError, which in turn causes reverse URL
resolution to
> fail, which in turn causes the "url" tag
(which is used by the admin)
> to fail.
> 

I heard runserver adds things to the path.  which would
explain why there is a 
difference.  Is this correct?

I am thinking maybe I am missing a 3rd party module?  which
wouldn't be on my 
path - is that what you mean?

Carl K

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: differences between runserver and apache
user name
2008-01-21 14:41:52
I'm having a similar issue. Last week after I moved from .95
to svn
and started having these problems. However, if I refresh
the
192.168.0.150/admin 4-5 times, the fifth refresh renders
admin as if
nothing is wrong.
The records I add or update are added and saved, but after I
restart
apache I'll get this error in the admin:
Tried update in module tswmls.notes.views. Error was:
'module' object
has no attribute 'update'
tswmls is my project name.

I expect "update" must be an module in admin,
because I have no class
named update in any of my projects. Another apache problem I
ran into
when moving to svn is I had to locate the django svn
directory in site-
packages. Just sym-linking from site-packages to my svn
directory did
not work with mod_python and apache as before. Apache or
mod_python
would not follow the sym-link, I'm not sure which causing
this. No
method of PythonPath tweeking worked, django simply did not
run until
I moved the files into site-packages. At the moment, django
runs, but
every so often I get the admin errors you have.

My Apache virtual server lines:
<VirtualHost 192.168.0.150>
<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE tswmls.settings
    PythonPath "['/home/webs/djtsw'] + sys.path"
    PythonDebug On
</Location>
<Directory "/home/webs/djtsw/public_html">
allow from all
Options +Indexes
</Directory>
<Location "/media">
    SetHandler none
</Location>
<LocationMatch ".(jpg|gif|png)$">
    SetHandler none
</LocationMatch>
DocumentRoot /home/webs/djtsw/public_html
</VirtualHost>

settings.py located at /home/web/djtsw/tswmls:
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/home/webs/djtsw/public_html/media'

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence
.com"
#MEDIA_URL = 'http://media.localhost'
MEDIA_URL = 'http://192.168.0.150/media
'

# URL prefix for admin media -- CSS, JavaScript and images.
Make sure
to use a
# trailing slash.
# Examples: "http://foo.com/media/&quo
t;, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '40n7dnlrx#ty0no12c1*j$(_y$8#ho)&^u&eofcout_643wk4'

# List of callables that know how to import templates from
various
sources.
TEMPLATE_LOADERS = (
   
'django.template.loaders.filesystem.load_template_source',
   
'django.template.loaders.app_directories.load_template_sourc
e',
#     'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
   
'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.doc.XViewMiddleware',
)

ROOT_URLCONF = 'tswmls.urls'

TEMPLATE_DIRS = (
    "/home/webs/djtsw/django_templates"
    # Put strings here, like
"/home/html/django_templates" or "C:/www/
django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative
paths.
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'tswmls.polls',
    'tswmls.notes',
    'tswmls.tsm',
    'tswmls.jobs',
    'tswmls.property',
    'tswmls.contacts',
    'tswmls.rental',
)


On Jan 21, 8:26 am, Carl Karsten <c...personnelware.com> wrote:
> James Bennett wrote:
> > On Jan 21, 2008 8:43 AM, Carl Karsten <c...personnelware.com> wrote:
> >> Exception Type: ViewDoesNotExist at /admin/
> >> Exception Value: Tried new_message in module
ridgemoor.core.views. Error was:
> >> 'module' object has no attribute
'new_message'
>
> > Most likely is that something that's different
between your Python
> > path under runserver and under Apache is causing
something to fail
> > with an ImportError, which in turn causes reverse
URL resolution to
> > fail, which in turn causes the "url" tag
(which is used by the admin)
> > to fail.
>
> I heard runserver adds things to the path.  which would
explain why there is a
> difference.  Is this correct?
>
> I am thinking maybe I am missing a 3rd party module? 
which wouldn't be on my
> path - is that what you mean?
>
> Carl K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )