ImportError: Could not import settings 'mysite.settings'

2009-02-06 Thread djandrow

Hello,

I'm trying to get my django project going on mod_python (this all on
on windows XP)
However when I try to get my project going I get

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

But I have this in my conf:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
PythonPath "['C:/Program Files/Apache2.2/htdocs/mysite'] +
sys.path"


What could be the cause of this, there is definetly a settings file?
>From reading other posts i got the impression this could be a
permissions issue but I didn't know how to change permissions on
windows and I wasn't sure that was the cause?

Could someone help me please?

Regards,

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



ImportError: Could not import settings 'mysite.settings'

2010-03-04 Thread RocB
Following instructions at
http://www.howtoforge.com/how-to-install-django-on-fedora9-apache2-mod_python
and
http://docs.djangoproject.com/en/1.1/howto/deployment/modpython/

I cannot get past the error:

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


I have check the python path, I even printed our sys.path from "/usr/
lib/python2.6/site-packages/django/conf/__init__.py, it looks like:

['/home/mycode', '/usr/lib/python2.6/site-packages/django', '/usr/
lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/
plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-
old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-
packages', '/usr/lib64/python2.6/site-packages/PIL', '/usr/lib64/
python2.6/site-packages/gst-0.10', '/usr/lib64/python2.6/site-packages/
gtk-2.0', '/usr/lib64/python2.6/site-packages/webkit-1.0', '/usr/lib/
python2.6/site-packages']


I have also chown and chmod the /home/mycode directory.  It is
readable by all.


My system is Fedora 12, apache 2.2.14, djanjo 1.1.1, python 2.6.2

I added to python.conf, the following:


SetHandler python-program
PythonPath "['/home/mycode', '/usr/lib/python2.6/site-packages/
django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonOption djanjo.root /mycode


Any thoughts ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: ImportError: Could not import settings 'mysite.settings'

2009-02-06 Thread Karen Tracey
On Fri, Feb 6, 2009 at 4:37 PM, djandrow  wrote:

>
> Hello,
>
> I'm trying to get my django project going on mod_python (this all on
> on windows XP)
> However when I try to get my project going I get
>
> ImportError: Could not import settings 'mysite.settings' (Is it on
> sys.path? Does it have syntax errors?): No module named
> mysite.settings
>
> But I have this in my conf:
>
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>PythonOption django.root /mysite
>PythonDebug On
>PythonPath "['C:/Program Files/Apache2.2/htdocs/mysite'] +
> sys.path"
> 
>
> What could be the cause of this, there is definetly a settings file?
> From reading other posts i got the impression this could be a
> permissions issue but I didn't know how to change permissions on
> windows and I wasn't sure that was the cause?
>
> Could someone help me please?
>

You've got the 'mysite' part in both the settings spec and the PythonPath.
Given what you have, Python will be looking for:

C:/Program Files/Apache2.2/htdocs/mysite/mysite/settings.py
Then, when that is not found, everyplace else in sys.path +
mysite/settings.py

If you are going to be including 'mysite' in your imports (and settings
spec), then don't include it in the PythonPath.  Or, drop if from your
imports (and settings spec).  (Or, include both the mysite directory and its
parent directory in your PythonPath, then you can mix inclusion of 'mysite'
in your imports with leaving it out willy-nilly,  but that is rather messy.
Better to pick one alternative and stick with it.)

Also, I'll repeat something I posted in another thread earlier today:

BTW your earlier spec for the PythonPath directive you are using showed you
are putting your project code under the default Apache document root htdocs
-- that is a bad idea as it may make your source code (including sensitive
stuff like database password in settings.py) easily accessible from the web,
depending on exactly how you have Apache configured.  Your Django project
source code does not need to be under Apache's document root, it simply
needs to be found via the PythonPath you specify in your Apache Location
block for your Django project.

Karen

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



Re: ImportError: Could not import settings 'mysite.settings'

2009-02-06 Thread djandrow

Thanks Karen, I've got it all working now.

Regards,

Andrew

On 6 Feb, 21:51, Karen Tracey  wrote:
> On Fri, Feb 6, 2009 at 4:37 PM, djandrow  wrote:
>
> > Hello,
>
> > I'm trying to get my django project going on mod_python (this all on
> > on windows XP)
> > However when I try to get my project going I get
>
> > ImportError: Could not import settings 'mysite.settings' (Is it on
> > sys.path? Does it have syntax errors?): No module named
> > mysite.settings
>
> > But I have this in my conf:
>
> > 
> >    SetHandler python-program
> >    PythonHandler django.core.handlers.modpython
> >    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >    PythonOption django.root /mysite
> >    PythonDebug On
> >    PythonPath "['C:/Program Files/Apache2.2/htdocs/mysite'] +
> > sys.path"
> > 
>
> > What could be the cause of this, there is definetly a settings file?
> > From reading other posts i got the impression this could be a
> > permissions issue but I didn't know how to change permissions on
> > windows and I wasn't sure that was the cause?
>
> > Could someone help me please?
>
> You've got the 'mysite' part in both the settings spec and the PythonPath.
> Given what you have, Python will be looking for:
>
> C:/Program Files/Apache2.2/htdocs/mysite/mysite/settings.py
> Then, when that is not found, everyplace else in sys.path +
> mysite/settings.py
>
> If you are going to be including 'mysite' in your imports (and settings
> spec), then don't include it in the PythonPath.  Or, drop if from your
> imports (and settings spec).  (Or, include both the mysite directory and its
> parent directory in your PythonPath, then you can mix inclusion of 'mysite'
> in your imports with leaving it out willy-nilly,  but that is rather messy.
> Better to pick one alternative and stick with it.)
>
> Also, I'll repeat something I posted in another thread earlier today:
>
> BTW your earlier spec for the PythonPath directive you are using showed you
> are putting your project code under the default Apache document root htdocs
> -- that is a bad idea as it may make your source code (including sensitive
> stuff like database password in settings.py) easily accessible from the web,
> depending on exactly how you have Apache configured.  Your Django project
> source code does not need to be under Apache's document root, it simply
> needs to be found via the PythonPath you specify in your Apache Location
> block for your Django project.
>
> Karen
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: ImportError: Could not import settings 'mysite.settings'

2010-03-04 Thread Karen Tracey
On Thu, Mar 4, 2010 at 7:13 PM, RocB  wrote:

> [snip]
> I have check the python path, I even printed our sys.path from "/usr/
> lib/python2.6/site-packages/django/conf/__init__.py, it looks like:
>
> ['/home/mycode', ...
>

So based on your config I'm assuming you have a mysite directory under
/home/mycode and in that mysite directory you have settings.py? If so, then
the path looks OK.


> I have also chown and chmod the /home/mycode directory.  It is
> readable by all.
>
> My system is Fedora 12, apache 2.2.14, djanjo 1.1.1, python 2.6.2
>
>
Fedora 12 has the security-enhanced linux kernel. If this is active on your
system then chown/chmod may not be doing what you expect. I only know enough
about selinux to tell you that much; how to configure it to enable Apache to
access /home directories is beyond me. But I do recall others on this list
have run into this type of problem when setting up machines that use
selinux.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: ImportError: Could not import settings 'mysite.settings'

2010-03-05 Thread roc bhakta
Thanks Karen for the tip on SELinux.  After researching,  I found i
needed to do:

setsebool -P httpd_enable_homedirs 1
chcon -R -t httpd_user_content_t  /home/mysite



On Thu, Mar 4, 2010 at 8:15 PM, Karen Tracey  wrote:
>
> Fedora 12 has the security-enhanced linux kernel. If this is active on your
> system then chown/chmod may not be doing what you expect. I only know enough
> about selinux to tell you that much; how to configure it to enable Apache to
> access /home directories is beyond me. But I do recall others on this list
> have run into this type of problem when setting up machines that use
> selinux.
>
> Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.