Someone on freenode's  #django mentioned using djblets to accomplish
this.
http://www.chipx86.com/blog/2008/04/03/django-development-with-djblets-unrooting-your-urls/

It did not work.

With "WSGIScriptAlias /apps /path/to/django_application/apache/
django.wsgi" in my apache configuration file, my site was already
being served up at /apps/.  So following that guide I wound up with my
site being served at /apps/apps/.  I realize that I could use
"WSGIScriptAlias / ..." but that is what IT won't allow me to do.
They want / to just serve static files from a directory.

So, I'd like to ask one of my questions again... what is the best way
to detect whether the code is running through Apache (an actual web
request) or outside (like a cron job that runs "./manage.py runscript"
from django-extensions)?  There has to be something that gets set that
I can look at to tell what context the code is running in.

Thanks,
~Eric


On Jun 15, 2:45 pm, "eric.frederich" <eric.freder...@gmail.com> wrote:
> Hello,
>
> I have been running a django site on apache using the following
> alias...
>
> WSGIScriptAlias /apps /path/to/django_application/apache/django.wsgi
>
> In doing this I was pleasantly surprised to see that most of the URLs
> worked fine.  The only thing I needed to change was LOGIN_URL='/apps/
> login' in settings.py.  Nowhere else in my code is /apps mentioned
> because apache sets some script prefix variable that wsgi tells django
> about and all is well.
>
> Now I am running into a problem with my cron jobs that run outside the
> context of apache and my URLs generated with "http://%s%s/"; %
> (Site.objects.get_current().domain, reverse(*args, **kwargs)) are
> missing the /apps part.
>
> I was okay with having one thing my code having /apps hard coded but
> now I'm looking at having to see what context I'm running in (apache
> vs. cron) and selectively adding this prefix.  This would introduce
> another place where I'd need /apps hard coded which I don't like.  I
> wasn't really happy with having to do it the one time.
>
> Questions:
>
> Would running in a subdomain solve all my problems?  For example using
> apps.example.com rather than example.com/apps/.
>
> Are there other parts of django that I have not run into yet that
> expect django to be ran at the root?
>
> If I can't get IT to give me a subdomain, what is the best way to
> detect whether the code is running inside Apache or outside so that I
> can slap /apps into my URLs?
>
> Thanks in advance,
> ~Eric
--~--~---------~--~----~------------~-------~--~----~
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