46          PythonPath "['*/home/hutch/apps/wikinotes/*'] + sys.path"


try this code



2009/3/6 Ishwor Gurung <ish...@loopback.ath.cx>

> Hi
> I want to run this django app I wrote called wikinotes (its a modified
> version of note application to maintain user single user session [1])
> for simple note taking. While the wikinotes works absolutely correctly
> using "python manage.py runserver", it fails to work if i use it with
> Apache and mod_python.
>
> Now, I am trying to http://localhost:8000/wikinotes it does a redirect
> to http://localhost:8000/static/login.html which is desired behaviour
> everything works as desired (This is using django's own server fired
> using "python manage.py runserver").
>
> However, when I try to log into http://localhost/wikinotes using
> Apache, it redirects to http://localhost/static/login.html as desired.
> But after pressing "login" form button this time, it fails with the
> following traceback -
>
> ----
> MOD_PYTHON ERROR
>
> ProcessId:      32469
> Interpreter:    'localhost.localdomain'
>
> ServerName:     'localhost.localdomain'
> DocumentRoot:   '/var/www/'
>
> URI:            '/wikinotes'
> Location:       '/wikinotes'
> Directory:      None
> Filename:       '/var/www/wikinotes'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 1537, in HandlerDispatch
>    default=default_handler, arg=req, silent=hlist.silent)
>
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 1229, in _process_target
>    result = _execute_target(config, req, object, arg)
>
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 1128, in _execute_target
>    result = object(arg)
>
>  File
> "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py",
> line 228, in handler
>    return ModPythonHandler()(req)
>
>  File
> "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py",
> line 191, in __call__
>    self.load_middleware()
>
>  File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py",
> line 31, in load_middleware
>    for middleware_path in settings.MIDDLEWARE_CLASSES:
>
>  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line
> 28, in __getattr__
>    self._import_settings()
>
>  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line
> 59, in _import_settings
>    self._target = Settings(settings_module)
>
>  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line
> 94, in __init__
>    raise ImportError, "Could not import settings '%s' (Is it on
> sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
>
> ImportError: Could not import settings 'wikinotes.settings' (Is it on
> sys.path? Does it have syntax errors?): No module named wikinotes.settings
>
> ----
> Apache config -
> i...@debian:[~/apps/wikinotes] cat -n /etc/apache2/sites-available/default
>     1  <VirtualHost *:80>
>    40
>    41          <Location "/wikinotes">
>    42          SetHandler python-program
>    43          PythonHandler django.core.handlers.modpython
>    44          SetEnv DJANGO_SETTINGS_MODULE wikinotes.settings
>    45          PythonDebug On
>    46          PythonPath "['/home/hutch/apps/wikinotes/wikinote'] +
> sys.path"
>    47          </Location>
>    48
>    49  </VirtualHost>
> ----
>
> i...@debian:[~/apps] ls
> wikinotes
>
> i...@debian:[~/apps/wikinotes] ls
> __init__.py  __init__.pyc  manage.py  media  settings.py  settings.pyc
>  static  urls.py  urls.pyc  wikinote  wikinotes.db
>
> i...@debian:[~/apps/wikinotes] cat -n urls.py
>     1  from django.conf.urls.defaults import *
>     2  from django.conf import settings
>     3
>     4  # Uncomment the next two lines to enable the admin:
>     5  from django.contrib import admin
>     6  admin.autodiscover()
>     7
>     8  urlpatterns = patterns('',
>     9      # Example:
>    10      #(r'^wikinotes/', include('wikinotes.wikinote.urls')),
>    11
>    12      # Uncomment the admin/doc line below and add
> 'django.contrib.admindocs'
>    13      # to INSTALLED_APPS to enable admin documentation:
>    14      # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>    15
>    16      # Uncomment the next line to enable the admin:
>    17      (r'^admin/(.*)', admin.site.root),
>    18      (r'^media/(?P<path>.*)$', 'django.views.static.serve',
> {'document_root': settings.MEDIA_ROOT }),
>    19      (r'^static/(?P<path>.*)$',
> 'django.views.static.serve',{'document_root': settings.STATIC_ROOT }),
>    20      (r'^', include('wikinotes.wikinote.urls')),
>    21  )
>
>
> i...@debian:[~/apps/wikinotes/wikinote] cat -n urls.py
>     1  # vim: ai ts=4 sts=4 et sw=4
>     2
>     3  from django.conf.urls.defaults import *
>     4  from wikinotes.wikinote.models import WikiNote
>     5  wikinotes = WikiNote.objects.all()
>     6
>     7  urlpatterns = patterns ('',
>     8      (r'^wikinotes$','wikinotes.wikinote.views.login_page'),
>     9
>
> (r'^view$','django.views.generic.list_detail.object_list',dict(queryset=wikinotes)),
>    10
>
> (r'^note/(?P<slug>[-\w]+)/update/$','wikinotes.wikinote.views.update_note'),
>    11
>
> (r'^note/(?P<slug>[-\w]+)/delete/$','wikinotes.wikinote.views.delete_note'),
>
>    12      (r'^login/$','wikinotes.wikinote.views.process_login'),
>    13      (r'^logout/$','wikinotes.wikinote.views.process_logout'),
>    14      (r'^create/$','wikinotes.wikinote.views.create_note'),
>    15      (r'^newnote/$','wikinotes.wikinote.views.create_new_note',
> dict({})),
>    16  #
> (r'^create/(?P<slug>[-\w]+)/$','wikinote.views.create_note',
> dict(queryset=wikinotes, slug_field="slug")),
>    17
>
> (r'^note/(?P<slug>[-\w]+)/$','django.views.generic.list_detail.object_detail',dict(queryset=wikinotes,
> slug_field="slug") ),
>    18  );
>    19
>
> Could someone give any pointer as to what is going wrong here? Please
> let me know if more stuffs are needed.
>
> Cheers,
> Ishwor
>
> [1]
>
> http://lethain.com/entry/2008/sep/21/intro-to-unintrusive-javascript-with-django/
>



-- 
Muslu YÜKSEKTEPE

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

Reply via email to