Skip to main content

Molo Global Site

Continuous Integration Code Coverage

Provides code to help with identifying visitors’ country and redirecting them to the relevant country site or the global site using the Molo code base.

Getting Started

Install molo.globalsite package:

pip install molo.globalsite

In your app settings add:

INSTALLED_APPS = (
   'molo.globalsite',
)

MIDDLEWARE = (
   'molo.globalsite.middleware.CountrySiteRedirectMiddleware'
)

# Global Site URL
GLOBAL_SITE_URL = environ.get('GLOBAL_SITE_URL', '')

# A path to geoip database.
GEOIP_PATH = join(dirname(dirname(abspath(__file__))), 'geoip_db')

You can download the geoip database country database from MaxMind or copy it from molo/globalsite/geoip_db.

Add Global site URL in your app urls.py:

urlpatterns += patterns('',
     url(r'^globalsite/', include('molo.globalsite.urls', namespace='molo.globalsite', app_name='molo.globalsite')),
)

Add the HTML block in your country site base template to allow users to change their country site:

{% block country %}
    {% if settings.globalsite.GlobalSiteSettings.show_country %}
        {% trans "Country" %}: {{request.site}}
        <a href="{% url 'molo.globalsite:change_country' %}">{% trans "Change your country" %}</a>
    {% endif %}
{% endblock %}

How users are redirected?

The middleware redirects the user by checking the session and if the country site is set in session it will redirect the user to the country site. If the country site is not in session and the geolocation is activated, it will use user’s IP address to detect their country and redirect the user to the supported country site. However if the detected country is not supported or the geolocation is not activated it will display the list of supported country sites.

GlobalSite Settings

The GlobalSite Settings can be accessed in the CMS under settings -> global site settings.

Activate Global Site: When activated it will set the current site as the global site.

Activate Auto Redirect: When activated it will automatically redirect the users to the country of their choice when accessing the global site.

Activate Geolocation: When activated it will detect user’s country and redirect them to the supported country site. If the detected country is not available it will display the available country sites.

Description: Description will be displayed on the homepage of the global site.

show_country: When activated, the country name will be displayed and users will be able to change their country site.

Country site and Region

Under Global site in CMS you are able to create the region/s of your country sites as well as the country site.

Metadata

Release files for molo.globalsite 7.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for molo.globalsite 7.0.1
File Size Uploaded
molo.globalsite-7.0.1.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for molo.globalsite 7.0.1
File Interpreter ABI Platform
molo.globalsite-7.0.1-py2-none-any.whl Python 2 none any Details

Total release size: 20.3 kB

Release files / molo.globalsite-7.0.1.tar.gz

Download URL molo.globalsite-7.0.1.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a830000e394d5399340eb92b43ad01be39ef6956730f45f94385ffcd92c638a7
BLAKE2b-256 checksum
How to use checksums
1fb301217d4bc4d5c23e25257d66484ffb42ca641532bbeed5f361cd71317db2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/2.7.14

Release files / molo.globalsite-7.0.1-py2-none-any.whl

Download URL molo.globalsite-7.0.1-py2-none-any.whl
Size 12.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
205ae11a744121db5b9d842446a9a4b6c9ed1f348f9ab2a618c31b6daf7a8d6b
BLAKE2b-256 checksum
How to use checksums
cc28b0d96509ec2c384ae15a3e468df0335d7f1cfbf6afa9e3b7f78c31e94bac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/2.7.14

Release history Release notifications | RSS feed

This release

7.0.1 This release

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.1.1

2 release files

5.1.0

2 release files

5.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page