Skip to main content

Global site to be used with Molo.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

molo.globalsite-7.0.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

molo.globalsite-7.0.1-py2-none-any.whl (12.1 kB view details)

Uploaded Python 2

File details

Details for the file molo.globalsite-7.0.1.tar.gz.

File metadata

  • Download URL: molo.globalsite-7.0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for molo.globalsite-7.0.1.tar.gz
Algorithm Hash digest
SHA256 a830000e394d5399340eb92b43ad01be39ef6956730f45f94385ffcd92c638a7
MD5 14c6758792f9e1903a9c8fa4a07cae8c
BLAKE2b-256 1fb301217d4bc4d5c23e25257d66484ffb42ca641532bbeed5f361cd71317db2

See more details on using hashes here.

Provenance

File details

Details for the file molo.globalsite-7.0.1-py2-none-any.whl.

File metadata

  • Download URL: molo.globalsite-7.0.1-py2-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 2
  • Uploaded using 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

File hashes

Hashes for molo.globalsite-7.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 205ae11a744121db5b9d842446a9a4b6c9ed1f348f9ab2a618c31b6daf7a8d6b
MD5 4d541e9dfa131515f48b2f9241f3e3d9
BLAKE2b-256 cc28b0d96509ec2c384ae15a3e468df0335d7f1cfbf6afa9e3b7f78c31e94bac

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page