About Django CentOS Apache

48 views
Skip to first unread message

Choro H

unread,
Apr 9, 2014, 7:44:29 AM4/9/14
to django...@googlegroups.com
i have the  following error, why? Please help me
ImportError: Could not import settings 'kanre.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named kanre.settings
ImportError: Could not import settings 'test.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named test.settings

i' m using : CentOS Django Apache mod_wsgi
and this is my :
 vim /etc/httpd/conf.d/virtualhost.conf

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName test/kanre
    WSGIScriptAlias /test/kanre /var/www/html/test/kanre/kanre/wsgi.py
    SetEnv DJANGO_SETTINGS_MODULE kanre.settings
    <Directory /var/www/html/test/kanre>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName test
    WSGIScriptAlias /test /var/www/html/test/test/test/wsgi.py
    SetEnv DJANGO_SETTINGS_MODULE test.settings
    <Directory /var/www/html/test/test>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

 and this is my:
vim /etc/httpd/conf.d/wsgi.conf
WSGIScriptAlias /test/kanre /var/www/html/test/kanre/kanre/wsgi.py

Alias /static/ "/test/kanre/kanre/static/"

WSGIScriptAlias /test /var/www/html/test/test/test/wsgi.py

Alias /static/ "/test/test/test/static/"




Daniel Roseman

unread,
Apr 9, 2014, 10:08:27 AM4/9/14
to django...@googlegroups.com
On Wednesday, 9 April 2014 12:44:29 UTC+1, Choro H wrote:
i have the  following error, why? Please help me
ImportError: Could not import settings 'kanre.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named kanre.settings
ImportError: Could not import settings 'test.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named test.settings



You should post your wsgi.py file. Are you setting the Python path there? If not, then you haven't told Python where to find your kanre or test projects, so it's not surprising it can't find them.
--
DR.

Choro H

unread,
Apr 10, 2014, 1:05:46 AM4/10/14
to django...@googlegroups.com
Thank you.

this is my wsgi.py file:

import os, sys
sys.path.append("/var/www/html/ihtmks_test/test")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")

import django.core.handlers.wsgi

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

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()



2014年4月9日水曜日 23時08分27秒 UTC+9 Daniel Roseman:
Reply all
Reply to author
Forward
0 new messages