Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FORCE_SCRIPT_NAME #115

Open
kefirbandi opened this issue Sep 18, 2013 · 0 comments
Open

FORCE_SCRIPT_NAME #115

kefirbandi opened this issue Sep 18, 2013 · 0 comments

Comments

@kefirbandi
Copy link

It may be my lack of understanding of the Django settings system, but in my settings.py I set the FORCE_SCRIPT_NAME variable to 'X" so my application is located under http://servername/X/ and not http://servername/, without adding 'X' every time in urls.py.

The problem I found that 'X' is not included in the url path of the ajax message sent from the JS side and so obviously it can not be interpreted on the server.

I think the solution could be something like modifying dajaxice.core.js as follows;

{% load settings_value %}
...
endpoint = '{% settings_value "FORCE_SCRIPT_NAME" %}{% url 'dajaxice-endpoint' %}'+dajaxice_function+'/';

Where settings_value is a template tag defined as follows:

from django import template
from django.conf import settings

register = template.Library()

@register.simple_tag
def settings_value(name):
    return getattr(settings, name, "")

This worked for me, but I am not sure if this is the correct approach, since I am a bit lost in the many configuration options of Django.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant