Hi folks,

I'm trying to run two projects through the same apache + fastcgi
combination, but I keep running into trouble. Can this actually be
done?
One general error I get is an 'attempt to write readonly database'
when I go to the admin page of the second project (in this example:
www.example.com/project2/admin/). And the debug page seems to indicate
that the request is actually send to the first project:
PATH_TRANSLATED: 'redirect:/project1.fcgi/admin//'.

I'm following
http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
The fcgi scripts are run under (the same) user account, while apache
is running under www-data.
It's not the ideal situation (I have root access actually), but it's a
test setup for a situation where we may be forced to go this way.

I can only think that the os.environ() is causing problems, being
different for the two projects, but otherwise setting the same
environment variable (since it's the same user running the script).
Also, I appear to be running into a caching problem, because changing
either of the settings.py (eg the DEBUG setting), or even introducing
a syntax error in that file, doesn't cause any change when visiting
the actual site.

I realise this question is not entirely Django, but possibly someone
on the list has a solution anyway. Or can tell me this simply can't be
done, and would (for example) require multiple user accounts, or some
other config change.

Here's my (slightly shortened) apache virtual host section:
 <VirtualHost *:80>
        ServerName www.example.com
        ServerAdmin ad...@example.com

        DocumentRoot /home/someone/www/example.com
        <Directory /home/someone/www/example.com>
                Allowoverride All
                Options +FollowSymLinks +ExecCGI
        </Directory>
 </VirtualHost>

The fcgi scripts (project1.fcgi and project2.fcgi) are very similar,
with just the DJANGO_SETTINGS_MODULE different:

  #! /usr/bin/env python
  import sys, os
  sys.path.insert(0, "/home/someone/")
  os.environ['DJANGO_SETTINGS_MODULE'] =
"project1.settings"    ("project2.settings" for the other project)
  from django.core.servers.fastcgi import runfastcgi
  runfastcgi(method="threaded", daemonize="false")

So the projects live in /home/someone/project[12]/

and the .htaccess:

 AddHandler fastcgi-script fcgi
 RewriteEngine On
 RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^project2/(.*)$ project2.fcgi/$1 [QSA,L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ project1.fcgi/$1 [QSA,L]

(I'm not 100% sure if this is correct for the .htaccess file either,
but it seems appropriate.)

Any enlightenment on this problem is welcome.

    Evert

--~--~---------~--~----~------------~-------~--~----~
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