Skip to content

Commit

Permalink
basic project setup
Browse files Browse the repository at this point in the history
  • Loading branch information
bbengfort committed Jul 16, 2016
1 parent 1305fd5 commit 5277a6e
Show file tree
Hide file tree
Showing 18 changed files with 623 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright 2016 District Data Labs

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
65 changes: 65 additions & 0 deletions Makefile
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
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn partisan.wsgi --log-file -
15 changes: 13 additions & 2 deletions README.md
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/)
Binary file added docs/img/partisan.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/index.md
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.
36 changes: 36 additions & 0 deletions manage.py
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)
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
site_name: My Docs
Empty file added partisan/__init__.py
Empty file.
18 changes: 18 additions & 0 deletions partisan/settings/__init__.py
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
##########################################################################
Loading

0 comments on commit 5277a6e

Please sign in to comment.