On Oct 17, 8:36 am, codingJoe <[email protected]> wrote:
> All,
>
> I am working through the django tutorial on the bitnami stack and am
> having difficulty getting my urls to work properly. The following
> references the tutorial part 3 - Poll details. I suspect the
> problem may be that the bitnami stack uses apache. But I have no idea
> how to configure apache and django to run the tutorial properly.
>
> 1. I enter the following into my browser: http://192.168.1.6:8080/polls/
>
> Response is a 404 error:
>
> Using the URLconf defined in mysite.urls, Django tried these URL
> patterns, in this order:
> 1. ^polls/
> 2. ^admin/doc/
> 3. ^admin/
> The current URL, , didn't match any of these.
>
> Question: Clearly 'polls' is in both the url and the files below.
> How do I configure this?
>
> ------------begin mysite/urls.py ----------------
> # Uncomment the next two lines to enable the admin:
> 4 from django.contrib import admin
> 5 admin.autodiscover()
> 6
> 7 urlpatterns = patterns('',
> 8 # Example:
> 9 # (r'^mysite/', include('mysite.foo.urls')),
> 10 (r'^polls/', include('polls.urls')),
> 11 (r'^admin/doc/',
> include('django.contrib.admindocs.urls')),
> 12 (r'^admin/', include(admin.site.urls)),
> 13 )
>
> ------------end mysite/urls.py ----------------
>
> ------------begin mysite/polls/urls.py ----------------
> 1 from django.conf.urls.defaults import *
> 2 from django.contrib import admin
> 3
> 4 admin.autodiscover()
> 5
> 6 urlpatterns = patterns('',
> 7 (r'^polls/$', 'polls.views.index'),
> 8 (r'^polls/(?P<poll_id>\d+)/$', 'detail'),
> 9 (r'^polls/(?P<poll_id>\d+)/results/$', 'results'),
> 10 (r'^polls/(?P<poll_id>\d+)/vote/$', 'vote'),
> 11 (r'^admin/doc/',
> include('django.contrib.admindocs.urls')),
> 12 (r'^admin/', include(admin.site.urls)),
> 13 )
>
> ------------begin django.conf ----------------
> # Note: Tried adding polls to line 3 but that didn't help.
> 1
> 2 WSGIScriptAlias /mysite "/Applications/djangostack-1.2.3-0/apps/
> django/conf/django.wsgi"
> 3 WSGIScriptAlias /polls "/Applications/djangostack-1.2.3-0/apps/
> django/conf/django.wsgi"
> 4
> 5 <Directory '/Applications/djangostack-1.2.3-0/apps/django/conf'>
> 6 Order deny,allow
> 7 Allow from all
> 8 </Directory>
>
> ------------end django.conf ----------------
>
> ------------begin django.wsgi ----------------
> import os, sys
> 2 sys.path.append('/Applications/djangostack-1.2.3-0/projects')
> 3 sys.path.append('/Applications/djangostack-1.2.3-0/projects/
> mysite')
> 4 os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
> 5
> 6 import django.core.handlers.wsgi
> 7
> 8 application = django.core.handlers.wsgi.WSGIHandler()
>
> ------------end django.wsgi ----------------
You're trying to run before you can walk here. The Django tutorial
teaches you how to set up urls and views using the built-in
development server. It's only once you understand those fully that you
should try and configure it with Apache.
However, the problem you're having is in your Apache configuration
file. For some reason, you're trying to set up ScriptAliases for each
URL. Don't do that. Just set up a single one for the root of your
site:
WSGIScriptAlias / "/Applications/djangostack-1.2.3-0/apps/django/
conf/django.wsgi"
That will then pick up all requests and pass them through to Django,
where they will be routed by urls.py.
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.