Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:36:56+00:00 2026-06-04T13:36:56+00:00

I wrote a webservices application over django. This application can be found as several

  • 0

I wrote a webservices application over django. This application can be found as several instances on our servers.

For example:

http://server1/testapp/
http://server2/sandboxapp/
http://server2/productionapp/

The app instances are hosted on apache2 through mod_wsgi.

I use cookie authentication for all of these instances, and would like the cookies for each not to overlap with the others. I need to set the SESSION_COOKIE_PATH value.

It happens that I don’t know beforehands the URLs behind which the application is deployed. So I’d like to use a reverse url to guess that value.

My main urls.py looks like this:

urlpatterns = patterns('',
    (r'admin/', include(admin.site.urls)),
     url(r'^$', view_server_root, {}, name='server_root'),
    ),
# here I also includes urls from the various sub-apps
for app in apps:
    urlpatterns.append(url(urlprefix,  include(app.urls))

I added this bit after all urls are loaded:

from django.core import urlresolvers
from django.conf import settings
settings.SESSION_COOKIE_PATH = urlresolvers.reverse('server_root')

Unfortunately urlresolvers.reverse('server_root') returns / and not the expected, for example, /testapp/. My cookies overlap if I log in to each instance.

Though, later on in the application usage, I use django.db.models.permalink for some views, which returns me a correct prefixed URL (e.g. /testapp/page/465).

There may be something with the context that is missing while executing urls.py.

Any ideas?

Thanks for reading.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:37:08+00:00Added an answer on June 4, 2026 at 1:37 pm

    You shouldn’t change Django settings at runtime. If you’re using Django 1.4 or later, you might be able to use reverse_lazy and set SESSION_COOKIE_PATH in your settings.py.

    SESSION_COOKIE_PATH = reverse_lazy('server_root')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Part of my project wrote all their code in C#. Our web application is
My application overview is alt text http://img823.imageshack.us/img823/8975/modelq.jpg ASP.Net webservice entertains requests from various applications
I am writing a Spring Restful webservices application using Spring MVC. I have used
We have an application written in C language which interacts with Oracle database. This
for a project we need to call some webservices from vbscript. This is doable,
I'm currently looking into possible ways we can refactor our codebase, to make it
I need to explore the world You wrote a killer application, but do you
I have an application that uses WebServices to send database records (as an array)
I wrote the following service : namespace WebService1 { [WebService(Namespace = http://tempuri.org/)] [WebServiceBinding(ConformsTo =
I'm migrating an old Delphi application that I wrote into C#. The application is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.