commit 2d70634ff38151a2dad567e8113186e789118425 Author: Tim Buckley Date: Mon Jul 13 15:55:45 2015 -0600 Initial import containing a barebones django / browserify project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d0da862 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +stackviz/static/bundle.js diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..387ced5 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,65 @@ +var gulp = require('gulp'); +var gutil = require('gulp-util'); +var path = require('path'); +var sourcemaps = require('gulp-sourcemaps'); +var source = require('vinyl-source-stream'); +var buffer = require('vinyl-buffer'); +var browserify = require('browserify'); +var watchify = require('watchify'); + +function configure() { + return browserify('./stackviz/static/js/app.js', { + debug: true + }) +} + +function rebundle(bundler) { + return bundler.bundle() + .on('error', function(err) { + console.error(err); + this.emit('end'); + }) + .pipe(source('bundle.js')) + .pipe(buffer()) + .pipe(sourcemaps.init({ loadMaps: true })) + .pipe(sourcemaps.write()) + .pipe(gulp.dest('./stackviz/static/')); +} + +function compile() { + return rebundle(configure()); +} + +var _count = 1; + +function watch() { + bundler = watchify(configure()); + + bundler.on('update', function(ids) { + var files = []; + ids.forEach(function(id) { + files.push(path.basename(id)); + }); + + var s = '[watch #' + _count + ']'; + gutil.log(gutil.colors.blue(s), + 'building...', + gutil.colors.gray('(', files.join(', '), ')')); + + rebundle(bundler); + }); + + bundler.on('log', function(msg) { + var s = '[watch #' + _count + ']'; + gutil.log(gutil.colors.blue(s), 'finished: ', msg); + + _count++; + }) + + return rebundle(bundler); +}; + +gulp.task('build', function() { return compile(); }); +gulp.task('watch', function() { return watch(); }); + +gulp.task('default', ['build']); diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..322ea59 --- /dev/null +++ b/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stackviz.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/package.json b/package.json new file mode 100644 index 0000000..79e998d --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "stackviz", + "version": "0.0.0", + "private": true, + "description": "A performance visualization utility for DevStack and Tempest", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "Apache 2.0", + "devDependencies": { + "browserify": "^10.2.6", + "d3": "^3.5.6", + "gulp": "^3.9.0", + "vinyl-buffer": "^1.0.0", + "vinyl-source-stream": "^1.1.0", + "watchify": "^3.2.1" + } +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e30fbea --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Django<1.8,>=1.4.2 diff --git a/stackviz/__init__.py b/stackviz/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/stackviz/settings.py b/stackviz/settings.py new file mode 100644 index 0000000..fca1ae1 --- /dev/null +++ b/stackviz/settings.py @@ -0,0 +1,76 @@ +""" +Django settings for stackviz project. + +For more information on this file, see +https://docs.djangoproject.com/en/1.7/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.7/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os +BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '*to^*vlhq&05jo0^kad)=kboy$8@&x9s6i23ukh*^%w_$=5bmh' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +TEMPLATE_DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = ( + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +) + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +) + +ROOT_URLCONF = 'stackviz.urls' + +WSGI_APPLICATION = 'stackviz.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.7/ref/settings/#databases + +DATABASES = {} + +# Internationalization +# https://docs.djangoproject.com/en/1.7/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.7/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/stackviz/static/index.html b/stackviz/static/index.html new file mode 100644 index 0000000..e69de29 diff --git a/stackviz/static/js/app.js b/stackviz/static/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/stackviz/urls.py b/stackviz/urls.py new file mode 100644 index 0000000..ec2f859 --- /dev/null +++ b/stackviz/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls import patterns, include, url +from django.contrib import admin + +urlpatterns = patterns('', + # Examples: + # url(r'^$', 'stackviz.views.home', name='home'), + # url(r'^blog/', include('blog.urls')), + + url(r'^admin/', include(admin.site.urls)), +) diff --git a/stackviz/wsgi.py b/stackviz/wsgi.py new file mode 100644 index 0000000..2c86f9a --- /dev/null +++ b/stackviz/wsgi.py @@ -0,0 +1,14 @@ +""" +WSGI config for stackviz project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ +""" + +import os +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stackviz.settings") + +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application()