a Django app to inject adsense ad code inside ckeditor body.
Project description
===== django_adsense_injector
django_adsense_injector is a Django app to inject adsense ad code inside ckeditor body. easy to intergrate and and show ads to the users.
Detailed documentation is in the "www.instandblog.xyz" website.
Quick start
-
Add "polls" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ... 'django_adsense_injector', ]
-
Add this line under templates settings in settings.py
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR,'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends', ], 'libraries':{ 'adsense_tags': 'django_adsense_injector.templatetags.adsense_tags' #<--------- } }, },
]
-
Include the template tags load tag like this inside the template::
{% load adsense_tags %}
-
Filter your ckeditor body field like below to inject your adsense code::
{{post.body|inject_adsense_after_paragraph:"your_template_directory/your_html_file_name.html"|safe}}
-
create
your_html_file_name.html
file inside the template directory and paste your adsense code. -
Start the development server http://127.0.0.1:8000/
-
Visit http://127.0.0.1:8000/your-post-url/ to see the outputs(you can't view adsense ad in the development time, but if you inspect the page you can see the injected code).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django_adsense_injector-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2f9c4f5ce61b31bc730f7431fec1ecc784743847742fbf3dae4acc2f4026e74 |
|
MD5 | e130f84531592efbb7c81ac8bfc724e4 |
|
BLAKE2b-256 | 79740e090b0220c29af8d9618d7a852d528680272b4ebffdfe7abd1342c60d15 |