I am making my first attempt to get django working with Apache.
Specifically, I'm trying to add some django functionality to a site
that is already running other web-based applications (mostly nagios).
So what I've done is create a project with "django-admin.py
startproject dashboard" in /home/source/django-projects and 'django-
admin.py startapp events" in /home/source/django-projects/dashboard.
I've added an Apache config file named "dashboard.conf" that contains:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /wsgitest /home/source/django-projects/dashboard/
test.wsgi
WSGIScriptAlias /dashboard/ /home/source/django-projects/dashboard/
dashboard/wsgi.py
WSGIPythonPath /home/source/django-projects/dashboard
<Directory /home/source/django-projects/dashboard>
Order allow,deny
Allow from all
</Directory>
"startproject" created /home/source/django-projects/dashboard/
dashboard/wsgi.py. It's the basic WSGI config file described in the
tutorials and the Djengo book, with some explanatory comments added.
Now I've got to build /home/source/django-projects/dashboard/dashboard/
urls.py. For testing purposes I would like a request for
http://<server>/dashboard/hello to execute function "hello" in /home/
source/django-projects/events/views.py. Do I understand the Django
book properly, that views.py should then contain:
from django.conf.urls import patterns, include, url
from events.views import hello
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url('^hello/$', hello),
#url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
#url(r'^admin/', include(admin.site.urls)),
)
This is how I've got things configured now, but when I try to go to
http://<server>/dashboard/hello I get a 404 error. And while playing
around I see that trying to go to http://<server>/dashboard/ gives me
a 500 error. Here's where it gets interesting: When I look in Apache's
error_log I see the following:
[Fri Mar 29 18:32:09 2013] [notice] Apache/2.2.3 (Red Hat) configured
-- resuming normal operations
[Fri Mar 29 18:32:09 2013] [info] Server built: May 28 2012 08:45:26
[Fri Mar 29 18:32:09 2013] [debug] prefork.c(996): AcceptMutex:
sysvsem (default: sysvsem)
[Fri Mar 29 18:32:09 2013] [info] mod_wsgi (pid=10818): Attach
interpreter ''.
[Fri Mar 29 18:32:09 2013] [info] mod_wsgi (pid=10818): Adding '/home/
source/django-projects/dashboard' to path.
[Fri Mar 29 18:32:09 2013] [info] mod_wsgi (pid=10820): Attach
interpreter ''.
[Fri Mar 29 18:32:09 2013] [info] mod_wsgi (pid=10820): Adding '/home/
source/django-projects/dashboard' to path.
[Fri Mar 29 18:32:09 2013] [info] mod_wsgi (pid=10817): Attach
interpreter ''.
[Fri Mar 29 18:32:09 2013] [info] mod_wsgi (pid=10817): Adding '/home/
source/django-projects/dashboard' to path.
[Fri Mar 29 18:32:23 2013] [error] [client 127.0.0.1] Target WSGI
script not found or unable to stat: /home/source/django-projects/
dashboard/dashboard/wsgi.pyhello
Where is the "hello" at the end of that last line coming from? I get
the same message in error_log whether I request http://<server>/dashboard/events
or http://<server>/dashboard/events/.
I realize that I must be screwing up something very simple, but trying
to django to cooperate with Apache is proving to be frustrating.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment