Re: Difficulty getting Django working with Apache and mod_python

2008-10-21 Thread projecktzero



On Oct 20, 4:17 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Mon, Oct 20, 2008 at 5:15 PM, projecktzero <[EMAIL PROTECTED]>wrote:
> > I'm pretty new to Django. I'm having trouble getting my Django
> > app/web-site to run under Apache2 and Mod_Python. I'm running Django
> > 0.96. I installed Apache2 and Mod_Python and tested both, and they
> > seem to work properly.
>
> > In my http.conf, I have the following:
>
> > 
> >    Python Path "['/usr/local/apache2/htdocs/hwsw2','/usr/lib/
> > python2.3/site-packages/django'] + sys.path"
> >    SetHandler python-program
> >    PythonHandler django.core.handlers.modpython
> >    SetEnv DJANGO_SETTINGS_MODULE hwsw2.settings
> >    PythonDebug On
> > 
>
> > The file permissions appear to be correct.(apache owns the .py files
> > and they are executable, the .html templates are all ready-only for
> > the world.)
>
> > Unfortunately, I get the following error:
>
> > EnvironmentError: Could not import settings 'hwsw2.settings' (Is it on
> > sys.path? Does it have syntax errors?): No module named hwsw2.settings
>
> > Does anyone have any ideas on what I did to mis-configure this?
>
> First, you've got a space in the PythonPath setting in your Location
> directive. Every example I've seen has no space there so I don't think a
> space is allowed (though I did not actually verify that a space breaks
> things).
>
> Second you've specified 'hwsw2' in both the PythonPath and the SetEnv for
> the settings module, so the file names that will be searched for are
> /usr/local/apache2/htdocs/hwsw2/hwsw2/settings.py, etc.  If you are going to
> specify the settings module as hwsw2.settings then
> '/usr/local/apache2/htdocs', without the trailing hwsw2, needs to be on your
> python path.  Whether you need both directories on the path depends on how
> you import things in your code. If you always specify hwsw2 in your imports
> than you don't need to have it be specified explicitly in the python path,
> just its parent.
>
> Third you don't need to specify anything under site-packages (site-packages
> is automatically searched) in the PythonPath, so you should remove
> '/usr/lib/python2.3/site-packages/django' from the PythonPath setting.
>
> Karen

Thanks Karen

I had caught the PythonPath issue after sending the post. Here's what
worked:


PythonPath "['/usr/local/apache2/htdocs'] + sys.path"
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE hwsw2.settings
PythonDebug On

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Difficulty getting Django working with Apache and mod_python

2008-10-20 Thread projecktzero

I'm pretty new to Django. I'm having trouble getting my Django
app/web-site to run under Apache2 and Mod_Python. I'm running Django
0.96. I installed Apache2 and Mod_Python and tested both, and they
seem to work properly.

In my http.conf, I have the following:


Python Path "['/usr/local/apache2/htdocs/hwsw2','/usr/lib/
python2.3/site-packages/django'] + sys.path"
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE hwsw2.settings
PythonDebug On


The file permissions appear to be correct.(apache owns the .py files
and they are executable, the .html templates are all ready-only for
the world.)

Unfortunately, I get the following error:

EnvironmentError: Could not import settings 'hwsw2.settings' (Is it on
sys.path? Does it have syntax errors?): No module named hwsw2.settings

Does anyone have any ideas on what I did to mis-configure this?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



forms with dynamic number of fields

2008-09-03 Thread projecktzero

Hi,

I'm new to Django. As a small project, I'm making a purchase request
form with one section that has the user information and the 2nd
section has items(computer hardware and software) that the user can
request. This list of items in the 2nd section is dynamic in that it
reads from a list of items in a database, so it can change depending
on what has been added/removed from the database. Is it possible to
use newforms for this type of form? If so, how? I'm using 0.96. I'm
not sure how I'd construct the form object.

class RequestForm(forms.Form):
username = forms.CharField(max_length=100)
email = forms.EmailField()
department = forms.CharField()
# some sort of class/dictionary... of items ordered, and qty
(laptops: qty 2, MS Visio 2003 qty 2)...
# this is where I get lost.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---