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

ReferenceError: Urls is not defined in ads.js #13

Open
wanjohikibui opened this issue Jun 7, 2019 · 5 comments
Open

ReferenceError: Urls is not defined in ads.js #13

wanjohikibui opened this issue Jun 7, 2019 · 5 comments

Comments

@wanjohikibui
Copy link

Been trying to solve this issue for some hours without success. I getting an error at Line 7 in ads.js file. The Urls is undefined. What could be the workaround here?
var url = Urls['ads:ad-impression']();

@razisayyed
Copy link
Owner

razisayyed commented Jul 16, 2019

Sorry for latency in replying to this issue. I was busy in the previous period.

You need to install django-js-reverse to solve this issue.

pip install django-js-reverse

please refere to django-js-reverse github homepage for installation instructions.
https://github.com/ierror/django-js-reverse

I will update the documenation and package requirements soon to solve this.

@wanjohikibui
Copy link
Author

wanjohikibui commented Jul 16, 2019 via email

@oesah
Copy link

oesah commented Jan 29, 2020

We should add it as a dependency to this project, I ran into the same issue.

@wanjohikibui
Copy link
Author

wanjohikibui commented Jan 30, 2020 via email

@MauricioVilla
Copy link

MauricioVilla commented May 15, 2020

Hello

I had this same problem and I solved it as follows:

  1. I Added django js reverse to INSTALED_APPS:
INSTALLED_APPS = (
    ...
    'django_js_reverse',
)
  1. Run collectstatic as instructed in django js reverse documentation
    ./manage.py collectstatic_js_reverse

  2. In the template I want to render the ads, load the django js reverse tags

{% load ads_tags %}
{% load js_reverse %}

<script type="text/javascript" charset="utf-8">
  {% js_reverse_inline %}
</script>

{% render_ads_zone 'content' %}

P.S.
I did not have to install django js reverse since in version 1.1.0 it was added as a dependency to the project

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

4 participants