diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/.DS_Store differ diff --git a/.vagrant/machines/default/virtualbox/action_provision b/.vagrant/machines/default/virtualbox/action_provision new file mode 100644 index 0000000..295441c --- /dev/null +++ b/.vagrant/machines/default/virtualbox/action_provision @@ -0,0 +1 @@ +1.5:f04bfbf0-1325-4cb4-a0e1-5ce72130f6b6 \ No newline at end of file diff --git a/.vagrant/machines/default/virtualbox/action_set_name b/.vagrant/machines/default/virtualbox/action_set_name new file mode 100644 index 0000000..a8dc631 --- /dev/null +++ b/.vagrant/machines/default/virtualbox/action_set_name @@ -0,0 +1 @@ +1486642324 \ No newline at end of file diff --git a/.vagrant/machines/default/virtualbox/creator_uid b/.vagrant/machines/default/virtualbox/creator_uid new file mode 100644 index 0000000..ec52cb8 --- /dev/null +++ b/.vagrant/machines/default/virtualbox/creator_uid @@ -0,0 +1 @@ +501 \ No newline at end of file diff --git a/.vagrant/machines/default/virtualbox/id b/.vagrant/machines/default/virtualbox/id new file mode 100644 index 0000000..a28269a --- /dev/null +++ b/.vagrant/machines/default/virtualbox/id @@ -0,0 +1 @@ +f04bfbf0-1325-4cb4-a0e1-5ce72130f6b6 \ No newline at end of file diff --git a/.vagrant/machines/default/virtualbox/index_uuid b/.vagrant/machines/default/virtualbox/index_uuid new file mode 100644 index 0000000..281a928 --- /dev/null +++ b/.vagrant/machines/default/virtualbox/index_uuid @@ -0,0 +1 @@ +fbd9456e3df14fd6aba07a3cb6bc8859 \ No newline at end of file diff --git a/.vagrant/machines/default/virtualbox/synced_folders b/.vagrant/machines/default/virtualbox/synced_folders new file mode 100644 index 0000000..249c862 --- /dev/null +++ b/.vagrant/machines/default/virtualbox/synced_folders @@ -0,0 +1 @@ +{"virtualbox":{"/vagrant":{"guestpath":"/vagrant","hostpath":"/Users/edd/Documents/sites/bakerydemo","disabled":false,"__vagrantfile":true}}} \ No newline at end of file diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..43d472c --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: uwsgi --http :$PORT --module bakerydemo.wsgi --master --offload-threads 1 diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..d93051c --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,76 @@ +# -*- 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. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://atlas.hashicorp.com/search. + config.vm.box = "torchbox/wagtail-jessie64" + config.vm.box_version = "~> 1.0" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8000" will access port 8000 on the guest machine. + config.vm.network "forwarded_port", guest: 8000, host: 8000 + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "../data", "/vagrant_data" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies + # such as FTP and Heroku are also available. See the documentation at + # https://docs.vagrantup.com/v2/push/atlas.html for more information. + # config.push.define "atlas" do |push| + # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" + # end + + # Enable provisioning with a shell script. Additional provisioners such as + # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the + # documentation for more information about their specific syntax and use. + # config.vm.provision "shell", inline: <<-SHELL + # sudo apt-get update + # sudo apt-get install -y apache2 + # SHELL + config.vm.provision :shell, :path => "vagrant/provision.sh", :args => "bakerydemo" + + # Enable agent forwarding over SSH connections. + config.ssh.forward_agent = true +end diff --git a/bakerydemo/.DS_Store b/bakerydemo/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/bakerydemo/.DS_Store differ diff --git a/bakerydemo/__init__.py b/bakerydemo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bakerydemo/__pycache__/__init__.cpython-34.pyc b/bakerydemo/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 0000000..c57a7c2 Binary files /dev/null and b/bakerydemo/__pycache__/__init__.cpython-34.pyc differ diff --git a/bakerydemo/__pycache__/urls.cpython-34.pyc b/bakerydemo/__pycache__/urls.cpython-34.pyc new file mode 100644 index 0000000..49e4f6a Binary files /dev/null and b/bakerydemo/__pycache__/urls.cpython-34.pyc differ diff --git a/bakerydemo/settings/.gitignore b/bakerydemo/settings/.gitignore new file mode 100644 index 0000000..75276c8 --- /dev/null +++ b/bakerydemo/settings/.gitignore @@ -0,0 +1 @@ +/local.py diff --git a/bakerydemo/settings/__init__.py b/bakerydemo/settings/__init__.py new file mode 100644 index 0000000..c787328 --- /dev/null +++ b/bakerydemo/settings/__init__.py @@ -0,0 +1 @@ +from .dev import * diff --git a/bakerydemo/settings/__pycache__/__init__.cpython-34.pyc b/bakerydemo/settings/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 0000000..ae2e163 Binary files /dev/null and b/bakerydemo/settings/__pycache__/__init__.cpython-34.pyc differ diff --git a/bakerydemo/settings/__pycache__/base.cpython-34.pyc b/bakerydemo/settings/__pycache__/base.cpython-34.pyc new file mode 100644 index 0000000..f5a3fb5 Binary files /dev/null and b/bakerydemo/settings/__pycache__/base.cpython-34.pyc differ diff --git a/bakerydemo/settings/__pycache__/dev.cpython-34.pyc b/bakerydemo/settings/__pycache__/dev.cpython-34.pyc new file mode 100644 index 0000000..ebc4680 Binary files /dev/null and b/bakerydemo/settings/__pycache__/dev.cpython-34.pyc differ diff --git a/bakerydemo/settings/base.py b/bakerydemo/settings/base.py new file mode 100644 index 0000000..d4fc762 --- /dev/null +++ b/bakerydemo/settings/base.py @@ -0,0 +1,189 @@ +""" +Django settings for bakerydemo project. + +Generated by 'django-admin startproject' using Django 1.8.2. + +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 + +PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +BASE_DIR = os.path.dirname(PROJECT_DIR) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ + + +# Application definition + +INSTALLED_APPS = [ + # 'bakerydemo.home', + # 'bakerydemo.search', + + 'wagtail.contrib.wagtailsearchpromotions', + 'wagtail.wagtailforms', + 'wagtail.wagtailredirects', + 'wagtail.wagtailembeds', + 'wagtail.wagtailsites', + 'wagtail.wagtailusers', + 'wagtail.wagtailsnippets', + 'wagtail.wagtaildocs', + 'wagtail.wagtailimages', + 'wagtail.wagtailsearch', + 'wagtail.wagtailadmin', + 'wagtail.wagtailcore', + + 'modelcluster', + 'compressor', + 'taggit', + + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE_CLASSES = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + + 'wagtail.wagtailcore.middleware.SiteMiddleware', + 'wagtail.wagtailredirects.middleware.RedirectMiddleware', +] + +ROOT_URLCONF = 'bakerydemo.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + os.path.join(PROJECT_DIR, 'templates'), + ], + '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 = 'bakerydemo.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'bakerydemo', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.8/topics/i18n/ + +LANGUAGE_CODE = 'en-gb' + +TIME_ZONE = 'Europe/London' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.8/howto/static-files/ + +STATICFILES_FINDERS = [ + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + 'compressor.finders.CompressorFinder', +] + +STATICFILES_DIRS = [ + os.path.join(PROJECT_DIR, 'static'), +] + +STATIC_ROOT = os.path.join(BASE_DIR, 'static') +STATIC_URL = '/static/' + +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +MEDIA_URL = '/media/' + + +# Django compressor settings +# http://django-compressor.readthedocs.org/en/latest/settings/ + +COMPRESS_PRECOMPILERS = [ + ('text/x-scss', 'django_libsass.SassCompiler'), +] + + +# Use Redis as the cache backend for extra performance + +CACHES = { + 'default': { + 'BACKEND': 'django_redis.cache.RedisCache', + 'LOCATION': '127.0.0.1:6379', + 'KEY_PREFIX': 'bakerydemo', + 'OPTIONS': { + 'CLIENT_CLASS': 'django_redis.client.DefaultClient', + } + } +} + + +# Use Elasticsearch as the search backend for extra performance and better search results + +WAGTAILSEARCH_BACKENDS = { + 'default': { + 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch', + 'INDEX': 'bakerydemo', + }, +} + + +# Wagtail settings + +WAGTAIL_SITE_NAME = "bakerydemo" diff --git a/bakerydemo/settings/dev.py b/bakerydemo/settings/dev.py new file mode 100644 index 0000000..8d0a7f4 --- /dev/null +++ b/bakerydemo/settings/dev.py @@ -0,0 +1,21 @@ +from .base import * + + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True +TEMPLATES[0]['OPTIONS']['debug'] = True + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'CHANGEME!!!' + +INTERNAL_IPS = ('127.0.0.1', '10.0.2.2') + +BASE_URL = 'http://localhost:8000' + +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + + +try: + from .local import * +except ImportError: + pass diff --git a/bakerydemo/settings/production.py b/bakerydemo/settings/production.py new file mode 100644 index 0000000..a94a2ab --- /dev/null +++ b/bakerydemo/settings/production.py @@ -0,0 +1,217 @@ +import os +import dj_database_url + +from .base import * + +# Do not set SECRET_KEY, Postgres or LDAP password or any other sensitive data here. +# Instead, use environment variables or create a local.py file on the server. + +# Disable debug mode +DEBUG = False +TEMPLATES[0]['OPTIONS']['debug'] = False + + +# Compress static files offline and minify CSS +# http://django-compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_OFFLINE +COMPRESS_OFFLINE = True +COMPRESS_CSS_FILTERS = [ + 'compressor.filters.css_default.CssAbsoluteFilter', + 'compressor.filters.cssmin.CSSMinFilter', +] +COMPRESS_CSS_HASHING_METHOD = 'content' + + +# Configuration from environment variables +# Alternatively, you can set these in a local.py file on the server + +env = os.environ.copy() + +# On Torchbox servers, many environment variables are prefixed with "CFG_" +for key, value in os.environ.items(): + if key.startswith('CFG_'): + env[key[4:]] = value + + +# Basic configuration + +APP_NAME = env.get('APP_NAME', 'bakerydemo') + +if 'SECRET_KEY' in env: + SECRET_KEY = env['SECRET_KEY'] + +if 'ALLOWED_HOSTS' in env: + ALLOWED_HOSTS = env['ALLOWED_HOSTS'].split(',') + +if 'PRIMARY_HOST' in env: + BASE_URL = 'http://%s/' % env['PRIMARY_HOST'] + +if 'SERVER_EMAIL' in env: + SERVER_EMAIL = env['SERVER_EMAIL'] + +if 'CACHE_PURGE_URL' in env: + INSTALLED_APPS += ( 'wagtail.contrib.wagtailfrontendcache', ) + WAGTAILFRONTENDCACHE = { + 'default': { + 'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend', + 'LOCATION': env['CACHE_PURGE_URL'], + }, + } + +if 'STATIC_URL' in env: + STATIC_URL = env['STATIC_URL'] + +if 'STATIC_DIR' in env: + STATIC_ROOT = env['STATIC_DIR'] + +if 'MEDIA_URL' in env: + MEDIA_URL = env['MEDIA_URL'] + +if 'MEDIA_DIR' in env: + MEDIA_ROOT = env['MEDIA_DIR'] + + +# Database + +if 'DATABASE_URL' in os.environ: + DATABASES = {'default': dj_database_url.config()} + +else: + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': env.get('PGDATABASE', APP_NAME), + 'CONN_MAX_AGE': 600, # number of seconds database connections should persist for + + # User, host and port can be configured by the PGUSER, PGHOST and + # PGPORT environment variables (these get picked up by libpq). + } + } + + +# Redis +# Redis location can either be passed through with REDIS_HOST or REDIS_SOCKET + +if 'REDIS_URL' in env: + REDIS_LOCATION = env['REDIS_URL'] + BROKER_URL = env['REDIS_URL'] + +elif 'REDIS_HOST' in env: + REDIS_LOCATION = env['REDIS_HOST'] + BROKER_URL = 'redis://%s' % env['REDIS_HOST'] + +elif 'REDIS_SOCKET' in env: + REDIS_LOCATION = 'unix://%s' % env['REDIS_SOCKET'] + BROKER_URL = 'redis+socket://%s' % env['REDIS_SOCKET'] + +else: + REDIS_LOCATION = None + + +if REDIS_LOCATION is not None: + CACHES = { + 'default': { + 'BACKEND': 'django_redis.cache.RedisCache', + 'LOCATION': REDIS_LOCATION, + 'KEY_PREFIX': APP_NAME, + 'OPTIONS': { + 'CLIENT_CLASS': 'django_redis.client.DefaultClient', + } + } + } + + +# Elasticsearch + +if 'ELASTICSEARCH_URL' in env: + WAGTAILSEARCH_BACKENDS = { + 'default': { + 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch', + 'URLS': [env['ELASTICSEARCH_URL']], + 'INDEX': APP_NAME, + 'ATOMIC_REBUILD': True, + }, + } + + +# Logging + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'class': 'django.utils.log.AdminEmailHandler', + }, + }, + 'formatters': { + 'default': { + 'verbose': '[%(asctime)s] (%(process)d/%(thread)d) %(name)s %(levelname)s: %(message)s' + } + }, + 'loggers': { + 'bakerydemo': { + 'handlers': [], + 'level': 'INFO', + 'propagate': False, + 'formatter': 'verbose', + }, + 'wagtail': { + 'handlers': [], + 'level': 'INFO', + 'propagate': False, + 'formatter': 'verbose', + }, + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': False, + 'formatter': 'verbose', + }, + 'django.security': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': False, + 'formatter': 'verbose', + }, + }, +} + + +if 'LOG_DIR' in env: + # bakerydemo log + LOGGING['handlers']['bakerydemo_file'] = { + 'level': 'INFO', + 'class': 'cloghandler.ConcurrentRotatingFileHandler', + 'filename': os.path.join(env['LOG_DIR'], 'bakerydemo.log'), + 'maxBytes': 5242880, # 5MB + 'backupCount': 5 + } + LOGGING['loggers']['wagtail']['handlers'].append('bakerydemo_file') + + # Wagtail log + LOGGING['handlers']['wagtail_file'] = { + 'level': 'INFO', + 'class': 'cloghandler.ConcurrentRotatingFileHandler', + 'filename': os.path.join(env['LOG_DIR'], 'wagtail.log'), + 'maxBytes': 5242880, # 5MB + 'backupCount': 5 + } + LOGGING['loggers']['wagtail']['handlers'].append('wagtail_file') + + # Error log + LOGGING['handlers']['errors_file'] = { + 'level': 'ERROR', + 'class': 'cloghandler.ConcurrentRotatingFileHandler', + 'filename': os.path.join(env['LOG_DIR'], 'error.log'), + 'maxBytes': 5242880, # 5MB + 'backupCount': 5 + } + LOGGING['loggers']['django.request']['handlers'].append('errors_file') + LOGGING['loggers']['django.security']['handlers'].append('errors_file') + + +try: + from .local import * +except ImportError: + pass diff --git a/bakerydemo/static/css/main.scss b/bakerydemo/static/css/main.scss new file mode 100644 index 0000000..439cbf1 --- /dev/null +++ b/bakerydemo/static/css/main.scss @@ -0,0 +1,23 @@ +/* Responsive image/video classes */ +.rich-text img { + max-width: 100%; + height: auto; +} +.richtext-image.left{ + float:left; +} +.richtext-image.right{ + float:right; +} +.responsive-object { + position: relative; +} +.responsive-object iframe, +.responsive-object object, +.responsive-object embed { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} diff --git a/bakerydemo/static/js/main.js b/bakerydemo/static/js/main.js new file mode 100644 index 0000000..e69de29 diff --git a/bakerydemo/templates/404.html b/bakerydemo/templates/404.html new file mode 100644 index 0000000..c6418c4 --- /dev/null +++ b/bakerydemo/templates/404.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block title %}404 - Page not found{% endblock %} + +{% block body_class %}template-404{% endblock %} + +{% block content %} +

Page not found

+ +

Sorry, this page could not be found.

+{% endblock %} diff --git a/bakerydemo/templates/500.html b/bakerydemo/templates/500.html new file mode 100644 index 0000000..2a5be4c --- /dev/null +++ b/bakerydemo/templates/500.html @@ -0,0 +1,17 @@ + + + + + + + + + Internal server error + + + +

Internal server error

+ +

Sorry, there seems to be an error. Please try again soon.

+ + diff --git a/bakerydemo/templates/base.html b/bakerydemo/templates/base.html new file mode 100644 index 0000000..0ceb4d4 --- /dev/null +++ b/bakerydemo/templates/base.html @@ -0,0 +1,38 @@ +{% load compress static wagtailuserbar %} + + + + + + + + + + {% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %} + + + + {% compress css %} + + {% endcompress %} + + {% block extra_css %} + + {% endblock %} + + + + {% wagtailuserbar %} + + {% block content %}{% endblock %} + + {% compress js %} + + {% endcompress %} + + {% block extra_js %} + + {% endblock %} + + + diff --git a/bakerydemo/urls.py b/bakerydemo/urls.py new file mode 100644 index 0000000..45bcf72 --- /dev/null +++ b/bakerydemo/urls.py @@ -0,0 +1,41 @@ +from django.conf.urls import include, url +from django.conf import settings +from django.contrib import admin + +from wagtail.wagtailadmin import urls as wagtailadmin_urls +from wagtail.wagtaildocs import urls as wagtaildocs_urls +from wagtail.wagtailcore import urls as wagtail_urls + +# from bakerydemo.search import views as search_views + + +urlpatterns = [ + url(r'^django-admin/', include(admin.site.urls)), + + url(r'^admin/', include(wagtailadmin_urls)), + url(r'^documents/', include(wagtaildocs_urls)), + + # url(r'^search/$', search_views.search, name='search'), + +] + + +if settings.DEBUG: + from django.conf.urls.static import static + from django.contrib.staticfiles.urls import staticfiles_urlpatterns + from django.views.generic import TemplateView + + # Serve static and media files from development server + urlpatterns += staticfiles_urlpatterns() + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + + # Add views for testing 404 and 500 templates + urlpatterns += [ + url(r'^test404/$', TemplateView.as_view(template_name='404.html')), + url(r'^test500/$', TemplateView.as_view(template_name='500.html')), + ] + + +urlpatterns += [ + url(r'', include(wagtail_urls)), +] diff --git a/bakerydemo/wsgi.py b/bakerydemo/wsgi.py new file mode 100644 index 0000000..05563c2 --- /dev/null +++ b/bakerydemo/wsgi.py @@ -0,0 +1,19 @@ +""" +WSGI config for bakerydemo 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 whitenoise.django import DjangoWhiteNoise + +from django.core.wsgi import get_wsgi_application + + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bakerydemo.settings.production") + +application = DjangoWhiteNoise(get_wsgi_application()) diff --git a/bin/post_compile b/bin/post_compile new file mode 100644 index 0000000..197cf6b --- /dev/null +++ b/bin/post_compile @@ -0,0 +1 @@ +python manage.py compress --settings bakerydemo.settings.production diff --git a/docs/.DS_Store b/docs/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/docs/.DS_Store differ diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..be8604a --- /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", "bakerydemo.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..eeb6827 --- /dev/null +++ b/readme.md @@ -0,0 +1,2 @@ +bakerydemo +================== diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..48510be --- /dev/null +++ b/requirements.txt @@ -0,0 +1,17 @@ +Django==1.9.9 +psycopg2==2.6.1 +elasticsearch==1.2.0 +django-redis==4.3.0 +wagtail==1.5.3 +django-libsass==0.6 +libsass==0.8.3 +Pillow==2.9.0 + +# Development tools +stellar==0.4.3 + +# Production dependencies +dj-database-url==0.3.0 +whitenoise==2.0.4 +uwsgi==2.0.11.2 +ConcurrentLogHandler==0.9.1 diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..294a23e --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.5.0 diff --git a/stellar.yaml b/stellar.yaml new file mode 100644 index 0000000..b4b162b --- /dev/null +++ b/stellar.yaml @@ -0,0 +1,6 @@ +logging: 30 +migrate_from_0_3_2: false +project_name: bakerydemo +stellar_url: postgresql+psycopg2:///stellar_data +tracked_databases: [bakerydemo] +url: postgresql+psycopg2:///template1 diff --git a/vagrant/provision.sh b/vagrant/provision.sh new file mode 100755 index 0000000..3cc2d46 --- /dev/null +++ b/vagrant/provision.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +PROJECT_NAME=$1 + +PROJECT_DIR=/vagrant +VIRTUALENV_DIR=/home/vagrant/.virtualenvs/$PROJECT_NAME + +PYTHON=$VIRTUALENV_DIR/bin/python +PIP=$VIRTUALENV_DIR/bin/pip + + +# Create database +su - vagrant -c "createdb $PROJECT_NAME" + + +# Virtualenv setup for project +su - vagrant -c "virtualenv --python=python3 $VIRTUALENV_DIR" +# Replace previous line with this if you are using Python 2 +# su - vagrant -c "virtualenv --python=python2 $VIRTUALENV_DIR" + +su - vagrant -c "echo $PROJECT_DIR > $VIRTUALENV_DIR/.project" + + +# Upgrade PIP +su - vagrant -c "$PIP install --upgrade pip" + +# Install PIP requirements +su - vagrant -c "$PIP install -r $PROJECT_DIR/requirements.txt" + + +# Set execute permissions on manage.py as they get lost if we build from a zip file +chmod a+x $PROJECT_DIR/manage.py + + +# Run syncdb/migrate/update_index +su - vagrant -c "$PYTHON $PROJECT_DIR/manage.py migrate --noinput && \ + $PYTHON $PROJECT_DIR/manage.py update_index" + + +# Add a couple of aliases to manage.py into .bashrc +cat << EOF >> /home/vagrant/.bashrc +export PYTHONPATH=$PROJECT_DIR +export DJANGO_SETTINGS_MODULE=$PROJECT_NAME.settings.dev + +alias dj="django-admin.py" +alias djrun="dj runserver 0.0.0.0:8000" + +source $VIRTUALENV_DIR/bin/activate +export PS1="[$PROJECT_NAME \W]\\$ " +cd $PROJECT_DIR +EOF