Initial import containing a barebones django / browserify project

This commit is contained in:
Tim Buckley 2015-07-13 15:55:45 -06:00
commit 2d70634ff3
11 changed files with 198 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
stackviz/static/bundle.js

65
gulpfile.js Normal file
View File

@ -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']);

10
manage.py Executable file
View File

@ -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)

20
package.json Normal file
View File

@ -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"
}
}

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
Django<1.8,>=1.4.2

0
stackviz/__init__.py Normal file
View File

76
stackviz/settings.py Normal file
View File

@ -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/'

View File

View File

10
stackviz/urls.py Normal file
View File

@ -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)),
)

14
stackviz/wsgi.py Normal file
View File

@ -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()