Skip to content
Source for the application that runs
Python HTML CSS JavaScript Shell Dockerfile Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
migrations Adjusting query for timeline select to use proper index (#544) Sep 4, 2019
scripts Optimize query for post restore (#301) May 18, 2017
setup Adjusting query for timeline select to use proper index (#544) Sep 4, 2019
.gitattributes Additional updates to ease local dev. (#61) Apr 10, 2017
docker-compose.yml New promotional block for MLTSHP shp (#514) Feb 20, 2019
requirements-test.txt Support for coveralls coverage reporting. (#359) May 27, 2017
requirements.txt Upgrading to Pillow 3.3.2 (#531) Jun 21, 2019



Build status Coverage Status

Development Environment

MLTSHP is a Dockerized application. This greatly simplifies running the application for local development. We also deploy the application using Docker, so it makes for a more consistent environment to build and test against.

With Docker and a git client installed on your computer, clone the MLTSHP code from Github. If you intend to develop features for MLTSHP, you should clone from your own fork of the code. Once you have a copy checked out locally, use this command to create a and file suitable for local development (edit these as needed, but the defaults should be okay):

$ make init-dev

Our stylesheets are SASS-based, so you'll also need to install the Ruby gem for SASS. If you don't have the sass command already, you can get it by running:

$ bundle install

If that gives you an error, maybe you need to first install the Ruby bundler package:

$ gem install bundler

Then, try the bundle install command.

So, with those pre-requisites in place, you should be able to start the app itself using:

$ make run

This will do a lot of things. But ultimately, you should end up with a copy of MLTSHP running locally. It expects to be accessed via a hostname of mltshp.local and s.mltshp.local. Add these entries to your /etc/hosts file:   mltshp.local s.mltshp.local

The web app itself runs on port 8000. You should be able to reach it via:


Subsequent invocations of make run should be faster, once you have the dependency images downloaded.

You can login as the admin user using the password password. You can also register new user accounts.

While running the service, you can open an editor to the git checkout and make updates to the code. Changes should be reflected as you save your files (no need to restart the service).

The MySQL instance that is launched will be accessible on if you want to look at the database directly (since this is using the default MySQL port, you will probably need to shutdown any existing MySQL server you may have running). The login for the database is root with no password. If you want to mark any of your user accounts as paid users, find them in the user table and set their is_paid value to 1 and their stripe_plan_id column value to mltshp-double.

Compiling Sass

You can run a Sass Watch command, which will automatically recompile the CSS whenever a change is detected to the Sass files using:

$ make sass-watch

Logs and Data

When you run the application, it launches it into a background process. But if you want to watch the realtime logs emitted by each service, just use this command:

$ docker-compose logs -f

In addition to that, the web app produces some log files that are captured under the "mounts/logs" folder of your git repository. The directory structure looks like this:

        (transient uploaded file storage)
        access.log - nginx access log file
        error.log - nginx error log file
        main-8000.log - python app log file
        celeryd-01.log - celery worker log file
        (local S3 storage)
        (mysql data files)

Database Migrations

Occassionally, a database migration will need to be performed to bring an older database schema up to date. This will be necessary if you have a MySQL database you use locally for development and testing and keep it versus using the destroy and init-dev commands to make a new one. To update your database, just do this:

$ make shell
docker-shell$ cd /srv/; python

That should do it.


With your copy of MLTSHP running, you may want to run unit tests. Some of the unit tests actually test against Twitter itself, so you'll want to generate a custom Twitter app with your own set of keys. Configure the test_settings in your file appropriately:

"twitter_consumer_key" : "twitter_consumer_key_here",
"twitter_consumer_secret" : "twitter_consumer_secret_key_here",
"twitter_access_key" : "twitter_access_key_here",
"twitter_access_secret" : "twitter_access_secret_here",

Then, just run:

$ make test

Which will invoke a Docker process to run the unit test suite.

Connecting to the MLTSHP shell

If you ever need to access the Docker image running the application, you can use this command to create a shell (specifically, a shell to the Python web application container):

$ make shell

This should place you in the /srv/ directory as the root user. You can use apt-get commands to install utilities you may need.


If you ever want to wipe your local data and rebuild your Docker containers, just use this command:

$ make destroy

If you just wish to rebuild the Docker container, use the Docker compose command:

$ docker-compose down

Then, run another make run.


MLTSHP is open-source software, ©2017 the MLTSHP team and released to the public under the terms of the Mozilla Public License. A copy of the MPL can be found in the LICENSE file.

You can’t perform that action at this time.