Re: Settings object has no attribute 'ROOT_URLCONF' while deploying using apache and mod_wsgi

223 views
Skip to first unread message

jirka.v...@gmail.com

unread,
Mar 17, 2013, 10:19:31 AM3/17/13
to django...@googlegroups.com
I'd look at how you reference your settings during imports. The error message spells "Settings" with uppercase "S" which feels incorrect.

HTH

Jirka
From: Navid Shaikh <shaikh...@gmail.com>
Date: Sun, 17 Mar 2013 02:20:29 -0700 (PDT)
Subject: Settings object has no attribute 'ROOT_URLCONF' while deploying using apache and mod_wsgi

Hi folks,

(Before posting I searched in archive and the question is kind of similar to thread [1].)

I am getting error:
AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'

I am using 
a) Django version 1.3.2.
b) Apache
c) mod_wsgi
 
I followed standard Django docs [2] to implement configurations.

Below are my some config file excerpts:
(I renamed my actual site name with mysite)

mysite-httpd.conf (filename)
-----

WSGIScriptAlias / "/usr/share/slate/apache/mysite.wsgi"

-----

mysite.wsgi   (filename)
------
#!/usr/bin/python
#
# For Apache mod_wsgi.
import os
import sys

path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

sys.path.append(path)                   # /usr/share/slate/
sys.path.append(os.path.dirname(path))  # /usr/share/

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
------

After reading thread[1] , I think that there is problem in setting 'DJANGO_SETTINGS_MODULE', as I have 'ROOT_URLCONF variable
set in settings.py.


Please point out where I am doing it wrong.

Links:


Thanks and Regards,
Navid Shaikh.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tom Evans

unread,
Mar 18, 2013, 8:47:26 AM3/18/13
to django...@googlegroups.com
On Sun, Mar 17, 2013 at 9:20 AM, Navid Shaikh <shaikh...@gmail.com> wrote:
> Hi folks,
>
> (Before posting I searched in archive and the question is kind of similar to
> thread [1].)
>
> I am getting error:
> AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'

Hi Navid

Can you show the structure of your project, where it is on disk and so
on. I suspect that in mysite.wsgi, you are inserting the wrong paths
into sys.path, and then Django cannot find your correct settings.

> Below are my some config file excerpts:
> (I renamed my actual site name with mysite)

It can be very hard to determine whether your settings are correct if
you are editing the data you are sending to us. Eg, you have edited
the DJANGO_SETTINGS_MODULE line in your wsgi script, it is not really
'mysite.settings', since your site is not actually called 'mysite'.

If you have typos in this line, eg "secretprojectname.settinsg", and
you overwrite that with "mysite.settings" when you send it to us, we
will find it difficult to determine that! Please consider whether the
secret name of your project is worth this amount of hiding!

Cheers

Tom

Navid Shaikh

unread,
Mar 18, 2013, 2:36:43 PM3/18/13
to django...@googlegroups.com, jirka.v...@gmail.com


On Sunday, March 17, 2013 7:49:31 PM UTC+5:30, JirkaV wrote:
I'd look at how you reference your settings during imports. The error message spells "Settings" with uppercase "S" which feels incorrect.

Hi Jirka,
I appreciate your response.
This is default behavior (I am not sure whether to call it bug) for reporting error.
There is no such matter of "S" in in error log.
The issue get resolved, please refer the following reply by me in same thread.

Regards,
Navid Shaikh

Navid Shaikh

unread,
Mar 18, 2013, 2:54:17 PM3/18/13
to django...@googlegroups.com, teva...@googlemail.com


On Monday, March 18, 2013 6:17:26 PM UTC+5:30, Tom Evans wrote:
Hi Navid

Can you show the structure of your project, where it is on disk and so
on. I suspect that in mysite.wsgi, you are inserting the wrong paths
into sys.path, and then Django cannot find your correct settings.

> Below are my some config file excerpts:
> (I renamed my actual site name with mysite)

It can be very hard to determine whether your settings are correct if
you are editing the data you are sending to us. Eg, you have edited
the DJANGO_SETTINGS_MODULE line in your wsgi script, it is not really
'mysite.settings', since your site is not actually called 'mysite'.

If you have typos in this line, eg "secretprojectname.settinsg", and
you overwrite that with "mysite.settings" when you send it to us, we
will find it difficult to determine that! Please consider whether the
secret name of your project is worth this amount of hiding!

Cheers

Tom

Hi Tom,
I appreciate your response to query.
Yes, you pointed it right.
The issue is resolved now.
Let me tell you more context:

I am deploying Django site using RPM package.
For that I needed a script (which is intended to run from spec file), fetching each line from settings.py and putting same line in mysite.conf file in /etc/httpd/mysite.conf.
So the intended process is:
settings.py ----------(each line)------> mysite.conf ----------(specify same name in spec file as well)-------=mysite.conf

Mistake I done:
settings.py-----------(each line)------->settings.conf----------(specify same name in spec file as well)------=mysite.conf

That means, I should have write mysite.conf however I wrote settings.conf (see red color text).

That is why actual settings.py was not getting feed, hence leading to mentioned error.

I admire your replies folks.
Thank you.

Regards,
Navid Shaikh.
 
Reply all
Reply to author
Forward
0 new messages