diff --git a/docs/installation.rst b/docs/installation.rst index 9bfe9d90d1c137583fa523e54cbfa20769379457..8474764667159c1aa0312efa1c5528bf29964655 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -17,6 +17,7 @@ In order to use the templates, you will need a supported version of Django. Project templates are supplied for the following Django versions:: * Django 1.8.x +* Django 1.10.x Cloning the repository diff --git a/docs/usage.rst b/docs/usage.rst index 208e50f391fbede16020f7c1c763cb226e1a77c4..2540f68dc5ccf726523fc0bfd81bf897c74236b4 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -14,6 +14,7 @@ variation. The following projects templates are currently available: - ``project-django-1.8`` +- ``project-django-1.10`` For example, in order to start a new Django project using version 1.8, run the command:: @@ -131,7 +132,7 @@ you would run:: Serving of static and media files ---------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Out of the box, project templates will configure ``/static/`` as base URL for static files, and ``/media/`` as base URL for media. @@ -159,7 +160,7 @@ specific static file from some other application. Working with the project ------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~ When running ``manage.py`` commands for a project, Django by default expects all settings to be found within the project's settings module. Specifically, it @@ -193,3 +194,16 @@ will reduce possibility of making a mistake. It should be noted that for running If you happen to be using a virtual environment, you can easily set up the post-activation script to set the ``DJANGO_SETTINGS_MODULE`` value. + + +Version specifics +~~~~~~~~~~~~~~~~~ + +This section outlines any specific differences between project templates. These +are mostly present due to differences in Django itself. + +- ``project-django-1.10`` sets-up password validation out of the box for all + environments except the development. In development environment the password + validation is explicitly disabled to allow short passwords (which should + result in faster develpment times as well). ``project-1.8.0`` does not have + this option enabled out of the box. diff --git a/project-django-1.10/manage.py b/project-django-1.10/manage.py new file mode 100755 index 0000000000000000000000000000000000000000..1421d37e1eba38c0a5ebb96cfc44c06b04f99274 --- /dev/null +++ b/project-django-1.10/manage.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") + + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + + execute_from_command_line(sys.argv) diff --git a/project-django-1.10/project_name/__init__.py b/project-django-1.10/project_name/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/project-django-1.10/project_name/settings/__init__.py b/project-django-1.10/project_name/settings/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/project-django-1.10/project_name/settings/base.py b/project-django-1.10/project_name/settings/base.py new file mode 100644 index 0000000000000000000000000000000000000000..24c24f162f084620c69eba179bb8097eb6b0301c --- /dev/null +++ b/project-django-1.10/project_name/settings/base.py @@ -0,0 +1,123 @@ +# +# Base settings for Django project {{ project_name }}. These settings are shared +# across all environments. +# +# Project created from template using Django {{ django_version }}. +# +# In order to specify environment-specific settings, use files: +# +# development.py +# testing.py +# staging.py +# production.py +# +# 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/ + + +# Base paths for accessing project root directory and directory where assets are +# stored. Other paths can be built relative to these directories with: +# os.path.join(BASE_DIR, ...) +# os.path.join(ASSETS_DIR, ...) +import os + +# Import the exception for signalling invalid configuration. No other +# Django-specific definitions should be imported here. +from django.core.exceptions import ImproperlyConfigured + +# Base and assets project directories. +BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +ASSETS_ROOT = os.path.normpath(os.path.join(os.path.dirname(BASE_DIR), "assets")) + +# List of installed applications. +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +# List of middleware classes to apply to incoming requests. +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', +) + +# URL configuration to use for serving project root. +ROOT_URLCONF = '{{ project_name }}.urls' + +# Template lookup and rendering configuration. +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 module for running the project. +WSGI_APPLICATION = '{{ project_name }}.wsgi.application' + + +# Password validation +# https://docs.djangoproject.com/en/{{ docs_version }}/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', + }, +] + + +# Language, internationalisation, and time configuration. +# +# For details see +# https://docs.djangoproject.com/en/{{ docs_version }}/topics/i18n/ +LANGUAGE_CODE = 'en-us' +TIME_ZONE = 'Europe/Stockholm' +USE_I18N = True +USE_L10N = True +USE_TZ = True + +# URLs for serving the static and media files. +STATIC_URL = '/static/' +MEDIA_URL = '/media/' + +# Directory for storing and serving user-uploaded files. +MEDIA_ROOT = os.path.normpath(os.path.join(ASSETS_ROOT, "media")) + +# Directory for storing and serving static files. +STATIC_ROOT = os.path.normpath(os.path.join(ASSETS_ROOT, "static")) + +# Additional directories from which to read the static files. This can be +# used for overriding application static files on project basis. +STATICFILES_DIRS = ( + os.path.normpath(os.path.join(BASE_DIR, '{{ project_name }}' , "static")), +) diff --git a/project-django-1.10/project_name/settings/development.py b/project-django-1.10/project_name/settings/development.py new file mode 100644 index 0000000000000000000000000000000000000000..edf5857ded59bda8f422ee069803b87cc40a265d --- /dev/null +++ b/project-django-1.10/project_name/settings/development.py @@ -0,0 +1,36 @@ +# Development environment settings for project {{ project_name }}. + +# Import the base settings. +from .base import * + +# Credentials in development environment are static. +SECRET_KEY="{{ secret_key }}" + +# Enable debugging in development environment. +DEBUG = True +for template_config in TEMPLATES: + template_config['OPTIONS']['debug']=True + +# Site administrators and managers. +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) +MANAGERS = ADMINS + +# Use SQLite3 for simplicity in development environment. +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'development.sqlite3', + 'USER': '', + 'PASSWORD': '', + 'HOST': '', + 'PORT': '', + } +} + +# Hostnames/FQDNs considered valid for accessing the installation. +ALLOWED_HOSTS = [] + +# Disable password validation in development. +AUTH_PASSWORD_VALIDATORS = [] diff --git a/project-django-1.10/project_name/settings/production.py b/project-django-1.10/project_name/settings/production.py new file mode 100644 index 0000000000000000000000000000000000000000..dfbb9e7fba36c095540a6c52a84cd3951da863e8 --- /dev/null +++ b/project-django-1.10/project_name/settings/production.py @@ -0,0 +1,41 @@ +# Production environment settings for project {{ project_name }}. + +# Import the base settings. +from .base import * + +# Import credentials. +try: + from .credentials import DATABASE_PASSWORD +except ImportError: + raise ImproperlyConfigured("Please configure DATABASE_PASSWORD in credentials.py.") + +try: + from .credentials import SECRET_KEY +except ImportError: + raise ImproperlyConfigured("Please configure SECRET_KEY in credentials.py.") + +# Disable debugging. +DEBUG = False +for template_config in TEMPLATES: + template_config['OPTIONS']['debug']=False + +# Site administrators and managers. +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) +MANAGERS = ADMINS + +# Database configuration. +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': '{{ project_name }}', + 'USER': '{{ project_name }}', + 'PASSWORD': DATABASE_PASSWORD, + 'HOST': '127.0.0.1', + 'PORT': '', + } +} + +# Hostnames/FQDNs considered valid for accessing the installation. +ALLOWED_HOSTS = [] diff --git a/project-django-1.10/project_name/settings/staging.py b/project-django-1.10/project_name/settings/staging.py new file mode 100644 index 0000000000000000000000000000000000000000..fde3c84449622ebaa778044b956b5ef91b5453a3 --- /dev/null +++ b/project-django-1.10/project_name/settings/staging.py @@ -0,0 +1,41 @@ +# Staging environment settings for project {{ project_name }}. + +# Import the base settings. +from .base import * + +# Import credentials. +try: + from .credentials import DATABASE_PASSWORD +except ImportError: + raise ImproperlyConfigured("Please configure DATABASE_PASSWORD in credentials.py.") + +try: + from .credentials import SECRET_KEY +except ImportError: + raise ImproperlyConfigured("Please configure SECRET_KEY in credentials.py.") + +# Disable debugging. +DEBUG = False +for template_config in TEMPLATES: + template_config['OPTIONS']['debug']=False + +# Site administrators and managers. +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) +MANAGERS = ADMINS + +# Database configuration. +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': '{{ project_name }}', + 'USER': '{{ project_name }}', + 'PASSWORD': DATABASE_PASSWORD, + 'HOST': '127.0.0.1', + 'PORT': '', + } +} + +# Hostnames/FQDNs considered valid for accessing the installation. +ALLOWED_HOSTS = [] diff --git a/project-django-1.10/project_name/settings/test.py b/project-django-1.10/project_name/settings/test.py new file mode 100644 index 0000000000000000000000000000000000000000..98c4939e1e1405f77801c8968293442282e7e6a6 --- /dev/null +++ b/project-django-1.10/project_name/settings/test.py @@ -0,0 +1,41 @@ +# Testing environment settings for project {{ project_name }}. + +# Import the base settings. +from .base import * + +# Import credentials. +try: + from .credentials import DATABASE_PASSWORD +except ImportError: + raise ImproperlyConfigured("Please configure DATABASE_PASSWORD in credentials.py.") + +try: + from .credentials import SECRET_KEY +except ImportError: + raise ImproperlyConfigured("Please configure SECRET_KEY in credentials.py.") + +# Disable debugging. +DEBUG = False +for template_config in TEMPLATES: + template_config['OPTIONS']['debug']=False + +# Site administrators and managers. +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) +MANAGERS = ADMINS + +# Database configuration. +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': '{{ project_name }}', + 'USER': '{{ project_name }}', + 'PASSWORD': DATABASE_PASSWORD, + 'HOST': '127.0.0.1', + 'PORT': '', + } +} + +# Hostnames/FQDNs considered valid for accessing the installation. +ALLOWED_HOSTS = [] diff --git a/project-django-1.10/project_name/static/.keep b/project-django-1.10/project_name/static/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/project-django-1.10/project_name/urls.py b/project-django-1.10/project_name/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..aa57b7e1f458f92e1e783eeda3e358115251d47f --- /dev/null +++ b/project-django-1.10/project_name/urls.py @@ -0,0 +1,20 @@ +"""{{ project_name }} URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/{{ docs_version }}/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import include, url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/project-django-1.10/project_name/wsgi.py b/project-django-1.10/project_name/wsgi.py new file mode 100644 index 0000000000000000000000000000000000000000..0d68b95645914d0f3e716f99fb8d9002898d0a90 --- /dev/null +++ b/project-django-1.10/project_name/wsgi.py @@ -0,0 +1,16 @@ +""" +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 + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") + +application = get_wsgi_application() diff --git a/project-django-1.10/requirements/base.txt b/project-django-1.10/requirements/base.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3e1f245ff98b59c8fa000e9b39a5c1691103119 --- /dev/null +++ b/project-django-1.10/requirements/base.txt @@ -0,0 +1 @@ +Django==1.10.3 diff --git a/project-django-1.10/requirements/development.txt b/project-django-1.10/requirements/development.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0cd5582c6652013aa8dc6095f1fce46da3fb588 --- /dev/null +++ b/project-django-1.10/requirements/development.txt @@ -0,0 +1,2 @@ +# Include requirements shared across all environments. +-r base.txt diff --git a/project-django-1.10/requirements/production.txt b/project-django-1.10/requirements/production.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0cd5582c6652013aa8dc6095f1fce46da3fb588 --- /dev/null +++ b/project-django-1.10/requirements/production.txt @@ -0,0 +1,2 @@ +# Include requirements shared across all environments. +-r base.txt diff --git a/project-django-1.10/requirements/staging.txt b/project-django-1.10/requirements/staging.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0cd5582c6652013aa8dc6095f1fce46da3fb588 --- /dev/null +++ b/project-django-1.10/requirements/staging.txt @@ -0,0 +1,2 @@ +# Include requirements shared across all environments. +-r base.txt diff --git a/project-django-1.10/requirements/test.txt b/project-django-1.10/requirements/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0cd5582c6652013aa8dc6095f1fce46da3fb588 --- /dev/null +++ b/project-django-1.10/requirements/test.txt @@ -0,0 +1,2 @@ +# Include requirements shared across all environments. +-r base.txt