diff --git a/.editorconfig b/.editorconfig index 2f5e583..8ec085a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,7 @@ indent_size = 4 [*.yml] indent_style = space indent_size = 2 + +[Vagrantfile] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore index 7b4f7ec..0a490b8 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,9 @@ docs/_build # Coverage.py htmlcov/ + +# Sqlite databases +*.sqlite3 + +# Vagrant boxes +.vagrant/ diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..53dcd8c --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,19 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure(2) do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + config.vm.box = "ubuntu/trusty64" + config.vm.network "forwarded_port", guest: 8000, host: 8000 + + config.vm.provision "ansible" do |ansible| + ansible.playbook = "provisioning/playbook.yml" + end +end diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml new file mode 100644 index 0000000..647bd9f --- /dev/null +++ b/provisioning/playbook.yml @@ -0,0 +1,30 @@ +- hosts: all + tasks: + - name: install git + apt: + name: git + state: latest + sudo: yes + + - name: download pip installer + get_url: + url: https://bootstrap.pypa.io/get-pip.py + dest: /tmp + + - name: install pip + command: python /tmp/get-pip.py + sudo: yes + + - name: install global python packages + pip: + name: "{{ item }}" + state: present + with_items: + - virtualenv + - virtualenvwrapper + sudo: yes + + - name: install sample project requirements + pip: + requirements: /vagrant/sample_project/requirements.txt + virtualenv: ~/venv diff --git a/sample_project/manage.py b/sample_project/manage.py new file mode 100755 index 0000000..9c651f3 --- /dev/null +++ b/sample_project/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sample_project.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/sample_project/requirements.txt b/sample_project/requirements.txt new file mode 100644 index 0000000..ddeae69 --- /dev/null +++ b/sample_project/requirements.txt @@ -0,0 +1,4 @@ +django<1.9 + +# django-watchman +-e /vagrant/ diff --git a/sample_project/sample_project/__init__.py b/sample_project/sample_project/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sample_project/sample_project/settings.py b/sample_project/sample_project/settings.py new file mode 100644 index 0000000..656430d --- /dev/null +++ b/sample_project/sample_project/settings.py @@ -0,0 +1,107 @@ +""" +Django settings for sample_project project. + +Generated by 'django-admin startproject' using Django 1.8.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.8/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.8/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'h%n@34@2nst!bm-ilj$3tfyq4-*iq@q@0_jjquu4$0g61ep-vy' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = ( + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'watchman', +) + +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', + 'django.middleware.security.SecurityMiddleware', +) + +ROOT_URLCONF = 'sample_project.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'sample_project.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + }, + 'secondary': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db_secondary.sqlite3'), + }, +} + + +# Internationalization +# https://docs.djangoproject.com/en/1.8/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.8/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/sample_project/sample_project/urls.py b/sample_project/sample_project/urls.py new file mode 100644 index 0000000..3efcb2e --- /dev/null +++ b/sample_project/sample_project/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import include, url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', include(admin.site.urls)), + url(r'^watchman/', include('watchman.urls')), +] diff --git a/sample_project/sample_project/wsgi.py b/sample_project/sample_project/wsgi.py new file mode 100644 index 0000000..d32b7ee --- /dev/null +++ b/sample_project/sample_project/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for sample_project 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.8/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sample_project.settings") + +application = get_wsgi_application()