Changeset - a9880bdda2ca
docs/installation.rst
Show inline comments
 
@@ -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
docs/usage.rst
Show inline comments
 
@@ -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.
project-django-1.10/manage.py
Show inline comments
 
new file 100755
 
#!/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)
project-django-1.10/project_name/__init__.py
Show inline comments
 
new file 100644
project-django-1.10/project_name/settings/__init__.py
Show inline comments
 
new file 100644
project-django-1.10/project_name/settings/base.py
Show inline comments
 
new file 100644
 
#
 
# 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")),
 
)
project-django-1.10/project_name/settings/development.py
Show inline comments
 
new file 100644
 
# 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 = []
project-django-1.10/project_name/settings/production.py
Show inline comments
 
new file 100644
 
# 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 = []
project-django-1.10/project_name/settings/staging.py
Show inline comments
 
new file 100644
 
# 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 = []
project-django-1.10/project_name/settings/test.py
Show inline comments
 
new file 100644
 
# 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 = []
project-django-1.10/project_name/static/.keep
Show inline comments
 
new file 100644
project-django-1.10/project_name/urls.py
Show inline comments
 
new file 100644
 
"""{{ 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),
 
]
project-django-1.10/project_name/wsgi.py
Show inline comments
 
new file 100644
 
"""
 
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()
project-django-1.10/requirements/base.txt
Show inline comments
 
new file 100644
 
Django==1.10.3
project-django-1.10/requirements/development.txt
Show inline comments
 
new file 100644
 
# Include requirements shared across all environments.
 
-r base.txt
project-django-1.10/requirements/production.txt
Show inline comments
 
new file 100644
 
# Include requirements shared across all environments.
 
-r base.txt
project-django-1.10/requirements/staging.txt
Show inline comments
 
new file 100644
 
# Include requirements shared across all environments.
 
-r base.txt
project-django-1.10/requirements/test.txt
Show inline comments
 
new file 100644
 
# Include requirements shared across all environments.
 
-r base.txt
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now