Hi, everyone.

My environment is python 2.52, mod_python-3.3.1, Apache2.2, PostgreSQL
8.3 and psycopg2-2.0.8. The Operation System is vista x64 ultimate.


The django Project folder is IntelligentNotesSystem ( created by
django-admin.py startproject IntelligentNotesSystem  ), which is
located in C:\Django\IntelligentNotesSystem.

The application folder is Core (created by python manage.py startapp
Core), which is located in C:\Django\IntelligentNotesSystem\Core.

All the template file is in C:\Django\IntelligentNotesSystem\Template

All the stylesheets and images are in C:\Django\IntelligentNotesSystem
\Site_media

The following is the sentences which I added to  Apache configuration:


LoadModule python_module modules/mod_python.so

<Location "/IntelligentNotesSystem/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE IntelligentNotesSystem.settings
    PythonOption django.root /IntelligentNotesSystem
    PythonDebug On
    PythonPath "['C:/Django'] + sys.path"
</Location>

<Location "/media/">
    SetHandler None
</Location>

<LocationMatch "\.(jpg|gif|png)$">
    SetHandler None
</LocationMatch>

-------------------------------------------------------------------------------------------------------------------------------

There is  a custom django form (forms.py) in the Core folder.

the content is that:

import re
from django import forms
from django.contrib.auth.models import User


class RegistrationForm(forms.Form):
  username = forms.CharField(label='Username', max_length=30)
  email = forms.EmailField(label='Email')
  password1 = forms.CharField(
    label='Password',
    widget=forms.PasswordInput()
  )
  password2 = forms.CharField(
    label='Password (Again)',
    widget=forms.PasswordInput()
  )

  def clean_username(self):
    username = self.cleaned_data['username']
    if not re.search(r'^\w+$', username):
      raise forms.ValidationError('Username can only contain
alphanumeric characters and the underscore.')
    try:
      User.objects.get(username=username)
    except:
      return username
    raise forms.ValidationError('Username is already taken.')

  def clean_password2(self):
    if 'password1' in self.cleaned_data:
      password1 = self.cleaned_data['password1']
      password2 = self.cleaned_data['password2']
      if password1 == password2:
        return password2
    raise forms.ValidationError('Passwords do not match.')

----------------------------------------------------------------------------------------------------------------------------------


The application runs well in the django server(in this url 
http://127.0.0.1:8000/).
However, it displays :


ImportError at /

No module named Core.forms

Request Method:         GET
Request URL:    http://localhost/
Exception Type:         ImportError
Exception Value:

No module named Core.forms

Exception Location:     C:/Django\IntelligentNotesSystem\Core\views.py in
<module>, line 6
Python Executable:      C:\Apache2.2\bin\httpd.exe
Python Version:         2.5.2
Python Path:    ['C:/Django', 'C:\\Windows\\system32\\python25.zip', 'C:\
\Python25\\Lib', 'C:\\Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', 'C:
\\Apache2.2', 'C:\\Apache2.2\\bin', 'C:\\Python25', 'C:\\Python25\\lib\
\site-packages']
Server time:    Fri, 12 Dec 2008 09:37:40 +1100
------------------------------------------------------------------------------------------------------------------------------------

when I use the appache server to run it.(In this url
http://localhost/IntelligentNotesSystem/)


The following text is the views.py

from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.contrib.auth import logout
from django.contrib.auth.models import User
from django.template import RequestContext
from django.shortcuts import render_to_response
from Core.forms import *
from django.template.loader import get_template

def main_page(request):
  return render_to_response('main_page.html', RequestContext(request))


def user_page(request,username):
    try:
        user = User.objects.get(username = username)
    except:
        raise Http404('Requested user not found.')
    bookmarks = user.bookmark_set.all()
    template = get_template('user_page.html')
    variables = RequestContext(request, {
        'username': username,
        'bookmarks': bookmarks
    })
    return render_to_response('user_page.html', variables)



def logout_page(request):
  logout(request)
  return HttpResponseRedirect('/')


def register_page(request):
  if request.method == 'POST':
    form = RegistrationForm(request.POST)
    if form.is_valid():
      user = User.objects.create_user(
        username=form.cleaned_data['username'],
        password=form.cleaned_data['password1'],
        email=form.cleaned_data['email']
      )
      return HttpResponseRedirect('/register/success/')
  else:
    form = RegistrationForm()

  variables = RequestContext(request, {
    'form': form
  })
  return render_to_response('registration/register.html', variables)

---------------------------------------------------------------------------------------------------------------------------------

Is there anyone can help me to fix this error


Thank you very much
Lee

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