On Aug 17, 2:43 pm, NiJoMi <milne...@googlemail.com> wrote:
> Done a reinstall and checked each step.
> ---------------------------------------------------
> Step 1: Installed WampServer2 and verified working
>         Location: C:\imfree
>         Components of WampServer 2.0i [11/07/09]
>         Apache 2.2.11
>         MySQL 5.1.36
>         PHP 5.3.0
> ---------------------------------------------------
> Step 2: Set up test enviroment
>         Created following folders
>         E:\localhost
>         E:\Django\djangotest
>         E:\Django\testsite2
>         placed unique index.html in each folder
>         edited hosts:
>         added
>         127.0.0.1       djangotest.lc
>         127.0.0.1       testsite2.lc
> ---------------------------------------------------
> Step 3: Set up Virtual Hosts
>         Edits to files:
>
>         httpd.conf:
>         # Uncommented following
>         # Virtual hosts
>         Include conf/extra/httpd-vhosts.conf
> ------------------------------------
>         http-vhosts.conf:
>         # Virtual Hosts
>         #
>         # Use name-based virtual hosting.
>         #
>         NameVirtualHost *:80
>         #
>         <VirtualHost *:80>
>                 ServerAdmin webmas...@djangotest.lc
>                 DocumentRoot "E:/Django/djangotest"
>                 ServerName djangotest.lc
>                 ServerAliaswww.djangotest.lc
>                 ErrorLog "logs/djangotest.lc-error.log"
>                 CustomLog "logs/djangotest.lc-access.log" common
>                 <Directory E:/Django/djangotest>
>                         Order allow,deny
>                         Allow from all
>                 </Directory>
>         </VirtualHost>
>
>         <VirtualHost *:80>
>                 ServerAdmin webmas...@testsite2.lc
>                 DocumentRoot "E:/Django/testsite2"
>                 ServerName testsite2.lc
>                 ServerAliaswww.testsite2.lc
>                 ErrorLog "logs/testsite2.lc-error.log"
>                 CustomLog "logs/testsite2.lc-access.log" common
>                 <Directory E:/Django/testsite2>
>                         Order allow,deny
>                         Allow from all
>                 </Directory>
>         </VirtualHost>
>
>         <VirtualHost *:80>
>                 ServerAdmin webmas...@dummy-host2.localhost
>                 DocumentRoot "E:/localhost"
>                 ServerName localhost
>                 ErrorLog "logs/localhost-error.log"
>                 CustomLog "logs/localhost-access.log" common
>                 <Directory E:/localhost>
>                         Order allow,deny
>                         Allow from all
>                 </Directory>
>         </VirtualHost>
>         Started server [ :) Working]
>         Stopped server
> ---------------------------------------------------
> Step 4: Installed Python 2.6.2
>         Location: C:\imfree\bin [keeping things tidy]
>         tested and verified working by the following methods
>         1. Start>All Programs>Python 2.6>python [ :) Working]
>         2. Start>Run>CMD
>            >cd C:\imfree\bin\Python26
>            C:\imfree\bin\Python26>python [ :) Working]
> ---------------------------------------------------
> Step 5. Install Django SVN
>         Location: C:\imfree\bin\Python26\Lib\site-packages\django
>         copied django-admin.py to C:\imfree\bin\Python26\Tools\Scripts
>         Tested by first deleting folder E:\Django\djangotest
>         then:
>         1.  Start>All Progams>Python 2.6>python
>                 entered import django into Python command line Result no 
> errors.
>
>         2.  Start>Run>CMD
>                 >E:
>                 E:\>cd DJango
>                 E:\Django>django-admin.py startproject djangotest
>                 'django-admin.py' is not recocognised as an internal or 
> external
> command,
>                 operable program or batch file. [ :( missing path?. use 
> set_path.]
>                 E:\Django>set 
> path=%path%;C:\imfree\bin\Python26\Tools\Scripts [path
> to django-admin.py]
>                 E:\Django>django-admin startproject djangotest
>                 E:\Django>cd djangotest
>                 E:\Django\djangotest>python manage.py runserver
>                 'python' is not recocognised as an internal or external 
> command,
>                 operable program or batch file. [ :( missing path?. use 
> set_path.]
>                 E:\Django\djangotest>set path=%path%;C:\imfree\bin\Python26 
> [path to
> python]
>                 E:\Django\djangotest>python manage.py runserver
>                 Validating models...
>                 0 errors found
>
>                 Django version 1.2 pre-alpha SVN-11464, using settings
> 'djangotest.settings'
>                 Development server is running athttp://127.0.0.1:800/
>                 Quit the server with CTRL-BREAK. [ :) Working]

You should not install Django site instance under DocumentRoot. If you
stuff up your Apache configuration at some point, your source code
would be downloadable, including any passwords in settings.py file.
So, keep them separate.

>         3.  Test with built in server
>                 edited httpd-vhosts.conf:
>                 <VirtualHost *:80> #changed to port 8000
>                         ServerAdmin webmas...@djangotest.lc
>                         DocumentRoot "E:/Django/djangotest"
>                         ServerName djangotest.lc
>                         ServerAliaswww.djangotest.lc
>                         ErrorLog "logs/djangotest.lc-error.log"
>                         CustomLog "logs/djangotest.lc-access.log" common
>                         <Directory E:/Django/djangotest>
>                                 Order allow,deny
>                                 Allow from all
>                         </Directory>
>                 </VirtualHost>
>                 Enteredhttp://djangotest.lc:8000/into browser [ :) Working 
> from
> built in server]
>                 Quit built in server
>                 changed virtualhost back to port 80
>                 Started apache server
>                 Enteredhttp://djangotest.lc:8000/into browser [ As expected
> Problem loading page]
>                 Enteredhttp://djangotest.lc/into browser [ 403 Forbidden?]
>                 Stopped server.
> ---------------------------------------------------
> Step 5. Install mod_wsgi
>         Copied mod_wsgi-win32-ap22py26-3.0c4.so to C:\imfree\bin\apache
> \Apache2.2.11\modules
>         renamed it to mod_wsgi.so
>         edited httpd.conf:
>         added LoadModule wsgi_module modules/mod_wsgi.so to top of LoadModule
> section.
>         Clear server log files
>         Start server
>         apache_error.log
>         [Mon Aug 17 03:51:12 2009] [notice] Apache/2.2.11 (Win32) PHP/5.3.0
> mod_wsgi/3.0c4 Python/2.6.2 configured -- resuming normal operations
>         [Mon Aug 17 03:51:12 2009] [notice] Server built: Dec 10 2008
> 00:10:06
>         [Mon Aug 17 03:51:12 2009] [notice] Parent: Created child process
> 1480
>         [Mon Aug 17 03:51:13 2009] [notice] Child 1480: Child process is
> running
>         [Mon Aug 17 03:51:13 2009] [notice] Child 1480: Acquired the start
> mutex.
>         [Mon Aug 17 03:51:13 2009] [notice] Child 1480: Starting 64 worker
> threads.
>         [Mon Aug 17 03:51:13 2009] [notice] Child 1480: Starting thread to
> listen on port 80.
>         Successfull install
>         Stop server
>         Clear server logs
> ---------------------------------------------------
> Step 6. Create E:\Djangotest\apache\django.wsgi
>         django.wsgi:
>         import os
>         import sys
>
>         os.environ['DJANGO_SETTINGS_MODULE'] = 'djangotest.settings'
>
>         import django.core.handlers.wsgi
>         application = django.core.handlers.wsgi.WSGIHandler()
> ---------------------------------------------------
> Step 7. Edit
>         httpd-vhosts.conf:
>         <VirtualHost *:80>
>                 ServerAdmin webmas...@djangotest.lc
>                 DocumentRoot "E:/Django/djangotest"
>                 ServerName djangotest.lc
>                 ServerAliaswww.djangotest.lc
>                 ErrorLog "logs/djangotest.lc-error.log"
>                 CustomLog "logs/djangotest.lc-access.log" common
>                 WSGIScriptAlias / /E:/Django/djangotest/apache/django.wsgi 
> #added
> this line

As I said before, a leading slash before drive specifier is wrong.
Should be:

  WSGIScriptAlias / E:/Django/djangotest/apache/django.wsgi

As I said before though, you shouldn't go sticking Django site under
your DocumentRoot, it is bad practice.

As a result, when you separate the two, you will need an additional
Directory directive like below, but for just the 'apache' subdirectory
you created to hold the WSGI script file.

>                 <Directory E:/Django/djangotest>
>                         Order allow,deny
>                         Allow from all
>                 </Directory>
>         </VirtualHost>
>         Start server
>         Enteredhttp://djangotest.lc/into browser [ 403 Forbidden]
>         apache_error.log
>         [Mon Aug 17 04:38:33 2009] [notice] Apache/2.2.11 (Win32) PHP/5.3.0
> mod_wsgi/3.0c4 Python/2.6.2 configured -- resuming normal operations
>         [Mon Aug 17 04:38:33 2009] [notice] Server built: Dec 10 2008
> 00:10:06
>         [Mon Aug 17 04:38:33 2009] [notice] Parent: Created child process 740
>         [Mon Aug 17 04:38:33 2009] [notice] Child 740: Child process is
> running
>         [Mon Aug 17 04:38:33 2009] [notice] Child 740: Acquired the start
> mutex.
>         [Mon Aug 17 04:38:33 2009] [notice] Child 740: Starting 64 worker
> threads.
>         [Mon Aug 17 04:38:33 2009] [notice] Child 740: Starting thread to
> listen on port 80.
>         other logs empty
>         Stop server
> ---------------------------------------------------
> Step 8. Edit django.wsgi
>         django.wsgi:
>         import os
>         import sys
>
>         sys.path.append('E:/Django/djangotest')
>         sys.path.append('C:/imfree/bin/Python26/Lib/site-packages/django')

Why are you adding site-packages directory Django directory. That will
not do anything that you want, and even if you mean to have site-
packages and not 'django' subdirectory, still shouldn't be required as
Python should automatically include the site-packages directory.

>         os.environ['DJANGO_SETTINGS_MODULE'] = 'djangotest.settings'
>
>         import django.core.handlers.wsgi
>         application = django.core.handlers.wsgi.WSGIHandler()
>         [same result 403 Forbidden]

Which will not work even if it found the WSGI script file because
'djangotest' will not be found. This is because you don't have 'E:/
Django/djangotest'.

Which instructions are you reading. Various of the things you are
doing wrong are explained in:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

as things you can do wrong.

Graham

> Nigel
>
> On Aug 15, 5:45 am, Graham Dumpleton <graham.dumple...@gmail.com>
> wrote:
>
>
>
> > On Aug 14, 10:53 pm, NiJoMi <milne...@googlemail.com> wrote:
>
> > > Installed Python 2.6.2 for all users and apache server failed to
> > > configure mod_wsgi, so I installed
> > > mod_wsgi-win32-ap22py26-3.0c4.so and renamed it mod_wsgi.so and apache
> > > configured the mod.
>
> > > however I am still getting 500 Internal Server Error
>
> > > testproject.lc-error.log
>
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] mod_wsgi
> > > (pid=360): Exception occurred processing WSGI script 'E:/Django/
> > > testproject/apache/django.wsgi'.
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] Traceback (most
> > > recent call last):
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> > > \Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
> > > 230, in __call__
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]
> > > self.load_middleware()
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> > > \Python26\\lib\\site-packages\\django\\core\\handlers\\base.py", line
> > > 33, in load_middleware
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]     for
> > > middleware_path in settings.MIDDLEWARE_CLASSES:
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> > > \Python26\\lib\\site-packages\\django\\utils\\functional.py", line
> > > 269, in __getattr__
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]     self._setup
> > > ()
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> > > \Python26\\lib\\site-packages\\django\\conf\\__init__.py", line 40, in
> > > _setup
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]
> > > self._wrapped = Settings(settings_module)
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> > > \Python26\\lib\\site-packages\\django\\conf\\__init__.py", line 75, in
> > > __init__
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]     raise
> > > ImportError, "Could not import settings '%s' (Is it on sys.path? Does
> > > it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
> > > [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] ImportError:
> > > Could not import settings 'testproject.settings' (Is it on sys.path?
> > > Does it have syntax errors?): No module named testproject.settings
>
> > Apache service runs as a special user, are your directories/files
> > actually readable to others. If they...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to