Django Samples

The best way to start using the SDK is to run a sample application that comes bundled with this SDK.

Before Running the Sample Application

Make sure you have a Translation Exchange account, and have created a project in your dashboard.

https://github.com/translationexchange/tml-django-samples-foody

$ git clone https://github.com/translationexchange/tml-django-samples-foody.git
$ cd tml-django-samples-foody
$ virtualenv --no-site-packages foody_env
$ . ./foody_env/bin/activate
$ pip install -r requirements.txt

Update your key in the following file: foody/settings.py

TML = {  
    'application': {
       'key': 'YOUR_APPLICATION_KEY'
      },
    'monkeypatch': True,
    'cache': {
        'enabled': True,
        'adapter': 'memcached',
        'backend': 'pylibmc'
    },
    'env_generators': ('tml.tools.viewing_user.get_viewing_user',),
    'logger': {
        'path': pj(BASE_DIR, 'logs', 'tml.log')
    }
}

Now you can start the application by running:

$ python manage.py runserver localhost:8000

This will start the Foody sample application on port 8000. Open your browser and point to: http://localhost:8000

Interactive Documentation

We also offer a fully interactive document in the Django SDK itself. It is located under the Django SDK source code.

https://github.com/translationexchange/tml-python-django

To install and use the sample, follow these steps:

$ git clone https://github.com/translationexchange/tml-python-django.git
$ cd tml-python-django/demo
$ virtualenv --no-site-packages tmldemo
$ . ./tmldemo/bin/activate
$ pip install -r requirements.txt
$ python manage.py migrate
$ python manage.py runserver localhost:8000

This will start the dummy application on port 8000. Open your browser and point to: http://localhost:8000