From 9b2d1d5b20ee46e0eefd1f74744d2e78118a25bd Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sat, 27 Jul 2013 16:35:41 +0200 Subject: [PATCH] Added first version of a 1.6.x compatible project template. --- manage.py | 11 +++++ project_name/__init__.py | 0 project_name/settings.py | 98 ++++++++++++++++++++++++++++++++++++++++ project_name/urls.py | 12 +++++ project_name/wsgi.py | 15 ++++++ requirements.txt | 3 ++ 6 files changed, 139 insertions(+) create mode 100755 manage.py create mode 100644 project_name/__init__.py create mode 100644 project_name/settings.py create mode 100644 project_name/urls.py create mode 100644 project_name/wsgi.py create mode 100644 requirements.txt diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..457fce0 --- /dev/null +++ b/manage.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") + os.environ.setdefault("DJANGO_CONFIGURATION", "Dev") + + from configurations.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/project_name/__init__.py b/project_name/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/project_name/settings.py b/project_name/settings.py new file mode 100644 index 0000000..c0f6a79 --- /dev/null +++ b/project_name/settings.py @@ -0,0 +1,98 @@ +""" +Django settings for {{ project_name }} project. + +For more information on this file, see +https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/ +""" +import os + +from configurations import Configuration, values + + +class Common(Configuration): + + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) + BASE_DIR = values.PathValue(os.path.dirname(os.path.dirname(__file__))) + + # Quick-start development settings - unsuitable for production + # See https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/checklist/ + + # SECURITY WARNING: keep the secret key used in production secret! + SECRET_KEY = '{{ secret_key }}' + + # SECURITY WARNING: don't run with debug turned on in production! + DEBUG = True + + TEMPLATE_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', + ) + + MIDDLEWARE_CLASSES = ( + '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', + ) + + ROOT_URLCONF = '{{ project_name }}.urls' + + WSGI_APPLICATION = '{{ project_name }}.wsgi.application' + + + # Database + # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#databases + # http://django-configurations.readthedocs.org/en/latest/values/#configurations.values.DatabaseURLValue + + DATABASES = values.DatabaseURLValue('sqlite://%s' % os.path.join(BASE_DIR, 'db.sqlite3'), + environ=True) + + # Internationalization + # https://docs.djangoproject.com/en/{{ docs_version }}/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/{{ docs_version }}/howto/static-files/ + + STATIC_URL = '/static/' + + +class Dev(Common): + """ + The in-development settings and the default configuration. + """ + pass + + +class Prod(Common): + """ + The in-production settings. + """ + DEBUG = False + TEMPLATE_DEBUG = DEBUG diff --git a/project_name/urls.py b/project_name/urls.py new file mode 100644 index 0000000..f03a294 --- /dev/null +++ b/project_name/urls.py @@ -0,0 +1,12 @@ +from django.conf.urls import patterns, include, url + +from django.contrib import admin +admin.autodiscover() + +urlpatterns = patterns('', + # Examples: + # url(r'^$', '{{ project_name }}.views.home', name='home'), + # url(r'^blog/', include('blog.urls')), + + url(r'^admin/', include(admin.site.urls)), +) diff --git a/project_name/wsgi.py b/project_name/wsgi.py new file mode 100644 index 0000000..17e13db --- /dev/null +++ b/project_name/wsgi.py @@ -0,0 +1,15 @@ +""" +WSGI config for {{ project_name }} 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/{{ docs_version }}/howto/deployment/wsgi/ +""" + +import os +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") +os.environ.setdefault("DJANGO_CONFIGURATION", "Dev") + +from configurations.wsgi import get_wsgi_application +application = get_wsgi_application() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2749bd1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +django-configurations>=0.4 +Django>=1.6 +dj-database-url==0.2.2 \ No newline at end of file