-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
623 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Shell to use with Make | ||
SHELL := /bin/sh | ||
|
||
# Set important Paths | ||
PROJECT := partisan | ||
LOCALPATH := $(CURDIR) | ||
PYTHONPATH := $(LOCALPATH) | ||
PYTHON_BIN := $(VIRTUAL_ENV)/bin | ||
DJANGO_ADMIN := $(LOCALPATH)/manage.py | ||
|
||
# Production Settings | ||
SETTINGS := production | ||
DJANGO_SETTINGS_MODULE = $(PROJECT).settings.$(SETTINGS) | ||
DJANGO_POSTFIX := --settings=$(DJANGO_SETTINGS_MODULE) --pythonpath=$(PYTHONPATH) | ||
|
||
# Development Settings | ||
LOCAL_SETTINGS := development | ||
DJANGO_LOCAL_SETTINGS_MODULE = $(PROJECT).settings.$(LOCAL_SETTINGS) | ||
DJANGO_LOCAL_POSTFIX := --settings=$(DJANGO_LOCAL_SETTINGS_MODULE) --pythonpath=$(PYTHONPATH) | ||
|
||
# Testing Settings | ||
TEST_SETTINGS := testing | ||
DJANGO_TEST_SETTINGS_MODULE = $(PROJECT).settings.$(TEST_SETTINGS) | ||
DJANGO_TEST_POSTFIX := --settings=$(DJANGO_TEST_SETTINGS_MODULE) --pythonpath=$(PYTHONPATH) | ||
|
||
# Apps to test | ||
APPS := partisan | ||
|
||
# Export targets not associated with files | ||
.PHONY: test showenv coverage bootstrap pip virtualenv clean virtual_env_set truncate | ||
|
||
# Show Virtual Environment | ||
showenv: | ||
@echo 'Environment:' | ||
@echo '------------------------' | ||
@$(PYTHON_BIN)/python -c "import sys; print('sys.path:', sys.path)" | ||
@echo 'PYTHONPATH:' $(PYTHONPATH) | ||
@echo 'PROJECT:' $(PROJECT) | ||
@echo 'DJANGO_SETTINGS_MODULE:' $(DJANGO_SETTINGS_MODULE) | ||
@echo 'DJANGO_LOCAL_SETTINGS_MODULE:' $(DJANGO_LOCAL_SETTINGS_MODULE) | ||
@echo 'DJANGO_TEST_SETTINGS_MODULE:' $(DJANGO_TEST_SETTINGS_MODULE) | ||
@echo 'VIRTUAL_ENV:' $(VIRTUAL_ENV) | ||
|
||
# Show help for Django | ||
djangohelp: | ||
$(DJANGO_ADMIN) help $(DJANGO_LOCAL_POSTFIX) | ||
|
||
# Run the development server | ||
runserver: | ||
$(DJANGO_ADMIN) runserver $(DJANGO_LOCAL_POSTFIX) | ||
|
||
# Clean build files | ||
clean: | ||
find . -name "*.pyc" -print0 | xargs -0 rm -rf | ||
find . -name "__pycache__" -print0 | xargs -0 rm -rf | ||
-rm -rf htmlcov | ||
-rm -rf .coverage | ||
-rm -rf build | ||
-rm -rf dist | ||
-rm -rf $(PROJECT)/*.egg-info | ||
|
||
# Targets for Django testing | ||
test: | ||
$(PYTHON_BIN)/coverage run --source=$(LOCALPATH) $(DJANGO_ADMIN) test $(LOCALPATH) $(DJANGO_TEST_POSTFIX) | ||
- $(PYTHON_BIN)/coverage report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: gunicorn partisan.wsgi --log-file - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
# partisan-discourse | ||
A web application that identifies party in political discourse and an example of operationalized machine learning. | ||
# Partisan Discourse | ||
|
||
**A web application that identifies party in political discourse and an example of operationalized machine learning.** | ||
|
||
[![Political Parties](docs/img/partisan.jpg)](https://flic.kr/p/a3bXVU) | ||
|
||
## About | ||
|
||
This small web application is intended to highlight how to operationalize machine learning models in a web application. Through the lens of a political classifier we see how models can be managed and stored inside of Django for per-user and global modeling. | ||
|
||
### Attribution | ||
|
||
The image used in this README, [Partisan Fail][https://flic.kr/p/a3bXVU] by [David Colarusso](https://www.flickr.com/photos/dcolarusso/) is licensed under [CC BY-NC 2.0](https://creativecommons.org/licenses/by-nc/2.0/) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Partisan Discourse Documentation | ||
|
||
The future home of the documentation for Partisan discourse. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
# manage.py | ||
# Django default management commands, with some special sauce. | ||
# | ||
# Author: Benjamin Bengfort <[email protected]> | ||
# Created: Tue Jul 05 13:26:09 2016 -0400 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: manage.py [] [email protected] $ | ||
|
||
""" | ||
Django default management commands, with some special sauce. | ||
""" | ||
|
||
########################################################################## | ||
## Imports | ||
########################################################################## | ||
|
||
import os | ||
import sys | ||
import dotenv | ||
|
||
########################################################################## | ||
## Main Method | ||
########################################################################## | ||
|
||
if __name__ == "__main__": | ||
## Manage Django Environment | ||
dotenv.read_dotenv() | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "partisan.settings.production") | ||
|
||
## Execute Django Utility | ||
from django.core.management import execute_from_command_line | ||
execute_from_command_line(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
site_name: My Docs |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# partisan.settings | ||
# Settings module for the Partisan Discourse application | ||
# | ||
# Author: Benjamin Bengfort <[email protected]> | ||
# Created: Sat Jul 16 11:25:19 2016 -0400 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: __init__.py [] [email protected] $ | ||
|
||
""" | ||
Settings module for the Partisan Discourse application | ||
""" | ||
|
||
########################################################################## | ||
## Imports | ||
########################################################################## |
Oops, something went wrong.