Deploying Django

14 views
Skip to first unread message

sakthi

unread,
Oct 26, 2011, 6:14:27 PM10/26/11
to Django users
Hi all,

I am running Apache in linux. I need to deploy my django app to it, so
i installed mod_python and configured the apache according to it. Then
I got an annoying error at the first page, that I couldn't figure out.
Please suggest a solution.

The error is:

ImportError at /gpa
No module named urls

Request Method: GET
Request URL: http://localhost/gpac/gpa
Django Version: 1.2.5
Exception Type: ImportError
Exception Value:

No module named urls

Exception Location: /usr/lib/pymodules/python2.7/django/utils/
importlib.py in import_module, line 35
Python Executable: /usr/bin/python
Python Version: 2.7.1
Python Path: ['/home/saki/', '/var/www', '/usr/lib/pymodules/
python2.7', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/
usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/
python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/
usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/
PIL', '/usr/lib/pymodules/python2.7/gtk-2.0', '/usr/lib/python2.7/dist-
packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0']

My apache conf file:

LoadModule python_module /usr/lib/apache2/modules/mod_python.so

<Location "/gpac/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE gpc.settings
PythonOption django.root /gpac
PythonPath "['/home/saki/','/var/www']+sys.path"
PythonDebug On
</Location>

gpc is the name of the app( directory containing all the source files
of the app.)

Please help

Thank you :)

Javier Guerra Giraldez

unread,
Oct 26, 2011, 6:19:18 PM10/26/11
to django...@googlegroups.com
On Wed, Oct 26, 2011 at 5:14 PM, sakthi <sakt...@gmail.com> wrote:
>.... i installed mod_python and....

that's where you got it wrong.

mod_python is obsolete and deprecated. the supported way to deploy
python apps with apache is mod_wsgi. check

https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/

--
Javier

sakthi

unread,
Oct 27, 2011, 5:13:56 AM10/27/11
to Django users
Ok. I installed mod_wsgi and did all configrations.

i created django.wsgi file in my app with all the entries and also
added WSGIScriptAlias / /home/saki/gpc/apache/django.wsgi to the
httpd.conf in apache.

Still i am getting an apache internal error. misconfigured.

i think its the problem with mod_wsgi. because the 'WSGIScriptAlias'
didnt change color( i am using vim). and the other 'Alias' changes
color to blue.

Is that the problem. Please help.

Thankyou :)



On Oct 27, 3:19 am, Javier Guerra Giraldez <jav...@guerrag.com> wrote:

Daniel Roseman

unread,
Oct 27, 2011, 5:24:52 AM10/27/11
to django...@googlegroups.com

On Thursday, 27 October 2011 10:13:56 UTC+1, sakthi wrote:
Ok. I installed mod_wsgi and did all configrations.

i created django.wsgi file in my app with all the entries and also
added WSGIScriptAlias / /home/saki/gpc/apache/django.wsgi to the
httpd.conf in apache.

Still i am getting an apache internal error. misconfigured.

So, what does the Apache error log (probably /var/log/httpd/error_log or /var/log/apache2/error.log) say?
--
DR.
Reply all
Reply to author
Forward
0 new messages