开发者

Django 0.96 and url

开发者 https://www.devze.com 2023-01-21 04:44 出处:网络
I want to get the absolute url of a given action in Django 0.96 (using Google App Engine). I have this url configuration:

I want to get the absolute url of a given action in Django 0.96 (using Google App Engine).

I have this url configuration:

from django.conf.urls.defaults import patterns
开发者_如何转开发
urlpatterns = patterns('framework.facebook',(r'^canvas/invite_friends$','views.inviteFriends'),
)

In my template:

window._url = '{% url views.inviteFriends %}';

I don't understand why this doesn't work.


Syntax for url is package.package.module.function args so if you replace 'views' with your module/ application name it should work.

{% url app_name.inviteFriends %}

An example:

If the full path to your function is myproject.myapp.views.inviteFriends code would be:

 {% url myapp.inviteFriends %}

or

{% url myproject.myapp.inviteFriends %}
0

精彩评论

暂无评论...
验证码 换一张
取 消