Sunday, May 1, 2011

Re: How to setup the django progject to apache2

Btw, the url.py is like this:

################################################################
from django.conf.urls.defaults import patterns, include, url
from django.views.generic import DetailView,ListView
from polls.models import Poll


# Uncomment the next two lines to enable the admin:

#zikey
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^polls/$',ListView.as_view(queryset=Poll.objects.order_by('-pub_date')[:5],
                                 context_object_name='latest_poll_list',        
                                          template_name='polls/index.html')),
)

#############################################################



2011/5/1 Steven Han <zikey77@gmail.com>
Hi,

I want to develop Django on the Apache2 server. And I have follow the some instruction about how to setup django app on the apache2 server.
but allows failed.

My system is Ubuntu 10.10. what my step as below:

(1)  sudo apt-get install apache2
(2) sudo apt-get install libapache2-mod-wsgi

when I opened 127.0.0.1 . "It works!" displayed. And I can find wsgi.conf and wsgi.load file under the path /etc/apache2/mods-enabled
So Apache2 and Mod_wsgi are installed.

My project "djcms" is under the path /home/zikey/Workspace/Django/djcms. And the "settings.py" file is under djcms folder.
I modifed the file httpd.conf as below:(original file is empty)
##############################################################################
<VirtualHost *:9000>
ServerAdmin webmaster@localhost
    
    WSGIScriptAlias / /home/zikey/Workspace/Django/djcms/django.wsgi
<Directory /home/zikey/Workspace/Django/djcms>
AllowOverride None
Order deny,allow
allow from all
</Directory>

</VirtualHost>

###############################################################################

And put the django.wsgi file under /home/zikey/Workspace/Django/djcms.
The content of django.wsgi is like this:
###############################################################################

import os
import sys

current_dir = os.path.dirname(__file__)

if current_dir not in sys.path:
    sys.path.append(current_dir)

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

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

###############################################################################

But every time I run the URL http://127.0.0.1:9000
it always displays:

"Oops! Google Chrome could not connect to 127.0.0.1:9000 "



:(
Do you know what I missed ?

Br,
Steven


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

No comments:

Post a Comment