Or do what I suggested you do in the first place and use mod_wsgi.

Run your main site in embedded mode and your test site in daemon mode.
This will give you the added advantage that to reload test instance,
just touch WSGI script file, no need to restart whole of Apache.

As well as stuff like SESSION_COOKIE_NAME, ensure you create two
isolated Python virtual environments so each instance is using
completely isolated environments. For Python virtual environments in
mod_wsgi to work properly, you must however not be loading mod_python
into Apache at the same time.

For details see:

  http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines
  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
  http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
  http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

Graham

On May 26, 11:36 am, Jason <[EMAIL PROTECTED]> wrote:
> Hi Graham--
>
> Thanks again for trying to talk me through this stuff.  Adding a
> different SESSION_COOKIE_NAME to my test site fixed the problem of
> having to re-login when switching between my active admin site & my
> test admin site.  However, the larger problem remains:  changes made
> to my test site's models are still not propagating to my test site's
> admin pages.  Bear in mind I'm still doing all this w/mod_python, &
> that I have two separate VirtualHosts for my main & test sites.
> Changes made to the main site's models are still regularly & reliably
> showing up in my main site's admin pages.
>
> So I'm flummoxed.  Guess it's a separate test box for me for the time
> being.  Thanks for trying though!
>
> On May 25, 2:34 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On May 25, 9:15 am, Jason <[EMAIL PROTECTED]> wrote:
>
> > > Well, actually things are not so bueno.  Everything's still working
> > > fine w/my my main instance, but any changes I make to models on my
> > > test instance (port 8080, different VirtualHost) are not propagating
> > > reliably-- or at all-- to the test site admin screen.  Have tried
> > > server restarts, syncdb, etc.  Sometimes I can get a minor change to
> > > turn up on the test site's admin, most often not.  Main server admin
> > > screen is not behaving erratically, for whatever reason.
>
> > > Also, the two admin (main & test) screens seem to interfere w/each
> > > other, inasmuch as if I'm logged in to one, I have to re-login to the
> > > other one.
>
> > > Barring someone having any insight here, I guess I should either
> > > investigatemod_wsgifor the test suite, or give up on the idea of
> > > having a test suite on the same box/apache instance-- which would be a
> > > major bummer.
>
> > Ensure you have set SESSION_COOKIE_NAME differently for each Django
> > instance in the settings.py files.
>
> > This is needed because each instance runs under same VirtualHost name.
> > Cookies are not distinguished based on port.
>
> > Look for some comments about this in:
>
> >  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> > It was talking about multiple instances mapped at different URL in
> > same virtual host/port number, but same applies if different port
> > number.
>
> > Graham
>
> > > On May 21, 6:14 pm, Jason <[EMAIL PROTECTED]> wrote:
>
> > > > And indeed, throwing in a "PythonInterpreter site" in my port 80
> > > > VirtualHost, & a PythonInterpreter testsite in my port 8080
> > > > VirtualHost solved all my problems.  You guys are the best!
>
> > > > On May 21, 5:54 pm, Jason <[EMAIL PROTECTED]> wrote:
>
> > > > > Awesome!  Thanks for all the advice, guys.  Will try the
> > > > > PythonInterpreter trick & get back to you.
>
> > > > > Just FYI, I'd deliberately ignored that part of the documentation
> > > > > since it specifies:
>
> > > > > "If you need to put two Django installations within the same
> > > > > VirtualHost, you’ll need to take a special precaution to ensure
> > > > > mod_python’s cache doesn’t mess things up. Use the PythonInterpreter
> > > > > directive to give different <Location> directives separate
> > > > > interpreters"
>
> > > > > ...and my two Django installations are very much in different
> > > > > VirtualHosts.  So maybe the docs could use a bit of revision there...?
>
> > > > > Also, I'd very much like to try themod_wsgistuff, so if anyone has a
> > > > > good pointer to docs/tutorials regarding that, I'd appreciate.  Though
> > > > > I suspect I'll have *something* googled w/in minutes of pressing
> > > > > "send" here, so no worries...
>
> > > > > Thanks again!
>
> > > > > On May 21, 4:52 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > > > > wrote:
>
> > > > > > On May 22, 9:41 am, Jason <[EMAIL PROTECTED]> wrote:
>
> > > > > > > On May 21, 4:17 pm, Jashugan <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > On May 21, 4:10 pm, Jason <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > Hey folks--
>
> > > > > > > > > I'm trying to set up a mirror instance of Django on our 
> > > > > > > > > webserver,
> > > > > > > > > having grown tired of bringing our whole site down every time 
> > > > > > > > > I'm
> > > > > > > > > debugging new code.
>
> > > > > > > > Why aren't you debugging on your local machine?
>
> > > > > > > a) thought it would be safer, environment-wise, to actually test 
> > > > > > > on
> > > > > > > the same machine, if possible, & b) don't really have a local 
> > > > > > > machine
> > > > > > > to test on.  Could set up something on my Mac, but that would be
> > > > > > > pretty radically different.  Have an Ubuntu-converted PC, but it's
> > > > > > > also pretty janky, & setting it up to exactly mirror our remote 
> > > > > > > server
> > > > > > > would be a daunting proposition.  And basically, I'd just rather 
> > > > > > > do it
> > > > > > > this way if I could.
>
> > > > > > > > > I've got an Apache VirtualHost set up on port 8080 that more 
> > > > > > > > > or less
> > > > > > > > > mirrors our website.   And I've installed a separate instance 
> > > > > > > > > of
> > > > > > > > > Django to work with it.
>
> > > > > > > > Are you listening on both ports? Check httpd.conf and make sure 
> > > > > > > > it has
> > > > > > > > something like this:
>
> > > > > > > > Listen 80
> > > > > > > > Listen 8080
>
> > > > > > > Oh yeah, that's all taken care of.  The "test site" is working 
> > > > > > > fine on
> > > > > > > port 8080, separate from the regular port 80 site.  My problem is 
> > > > > > > that
> > > > > > > if I change the Django settings exclusively on the port 8080
> > > > > > > VirtualHost (as per my last post), it also changes my main sites
> > > > > > > settings & throws me into the empty new Django install.  Hope 
> > > > > > > that's
> > > > > > > clear...?
>
> > > > > > In mod_python, a single Python interpreter instance is used for a
> > > > > > virtual host. This doesn't take into consideration the port number. 
> > > > > > As
> > > > > > such, you would be sharing the same Python interpreter for all 
> > > > > > Django
> > > > > > instances on the same virtual host.
>
> > > > > > To avoid this, use the PythonInterpreter directive from mod_python 
> > > > > > to
> > > > > > designate that each instance should run in a separate interpreter.
>
> > > > > > Better still perhaps, usemod_wsgi. Run your main live Django 
> > > > > > instance
> > > > > > in embedded mode (like with mod_python), but delegate your test
> > > > > > instance to a separate process(es) usingmod_wsgidaemon mode.
>
> > > > > > This has the benefit that they do not run in the same process and 
> > > > > > thus
> > > > > > will not interfere with each other. More importantly,mod_wsgi2.0
> > > > > > daemon mode will recycle the daemon processes and reload your
> > > > > > application, without having to restart the whole of Apache, by 
> > > > > > simply
> > > > > > touching (modifying time stamp) the WSGI script file which is the
> > > > > > entry point for your application.
>
> > > > > > Thus you achieve your aim of using same machine setup, but of being
> > > > > > able to restart Django instance without restarting whole of Apache.
>
> > > > > > Graham
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to