Changeset - d5446363fedf
[Not reviewed]
default
3 10 0
Branko Majic (branko) - 6 years ago 2017-12-21 15:06:47
branko@majic.rs
CONNT-25: Updating application and project to use Django 1.7.x:

- Updated test project to use the same base template as the fresh
Django project started with Django 1.7.x admin tool.
- Fixed deprecation warnings related to model forms not including
explicit list of fields to be included or excluded.
- Removed all South migrations, replacing them with native Django
migration.
- Updated release notes.
- Bumped Django version in setup script.
- Bumped Django version in requirements files.
- Removed South from both installation and development requirements.
13 files changed with 199 insertions and 560 deletions:
0 comments (0 inline, 0 general)
conntrackt/forms.py
Show inline comments
 
@@ -94,6 +94,7 @@ class EntityForm(WidgetCSSClassFormMixin
 

	
 
    class Meta:
 
        model = Entity
 
        fields = ['name', 'description', 'project', 'location']
 

	
 
    widget_placeholders = {"name": "Entity name",
 
                           "description": "Entity description"}
 
@@ -107,6 +108,7 @@ class InterfaceForm(WidgetCSSClassFormMi
 

	
 
    class Meta:
 
        model = Interface
 
        fields = ['name', 'description', 'entity', 'address', 'netmask']
 

	
 
    widget_placeholders = {"name": "Interface name",
 
                           "description": "Interface description",
 
@@ -123,6 +125,7 @@ class CommunicationForm(WidgetCSSClassFo
 

	
 
    class Meta:
 
        model = Communication
 
        fields = ['source', 'destination', 'protocol', 'port', 'description']
 

	
 
    widget_placeholders = {"port": "Port used for communication",
 
                           "description": "Communication description"}
 
@@ -137,6 +140,7 @@ class ProjectForm(WidgetCSSClassFormMixi
 

	
 
    class Meta:
 
        model = Project
 
        fields = ['name', 'description']
 

	
 
    widget_placeholders = {"name": "Project name",
 
                           "description": "Project description"}
 
@@ -151,6 +155,7 @@ class LocationForm(WidgetCSSClassFormMix
 

	
 
    class Meta:
 
        model = Location
 
        fields = ['name', 'description']
 

	
 
    widget_placeholders = {"name": "Location name",
 
                           "description": "Location description"}
conntrackt/migrations/0001_initial.py
Show inline comments
 
@@ -18,122 +18,113 @@
 
# Django Conntrackt.  If not, see <http://www.gnu.org/licenses/>.
 
#
 

	
 

	
 
# -*- coding: utf-8 -*-
 
import datetime
 
from south.db import db
 
from south.v2 import SchemaMigration
 
from django.db import models
 

	
 

	
 
class Migration(SchemaMigration):
 

	
 
    def forwards(self, orm):
 
        # Adding model 'Project'
 
        db.create_table('conntrackt_project', (
 
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
            ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
 
            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
 
        ))
 
        db.send_create_signal('conntrackt', ['Project'])
 

	
 
        # Adding model 'Location'
 
        db.create_table('conntrackt_location', (
 
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
            ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
 
            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
 
        ))
 
        db.send_create_signal('conntrackt', ['Location'])
 
from __future__ import unicode_literals
 

	
 
        # Adding model 'Entity'
 
        db.create_table('conntrackt_entity', (
 
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
            ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
 
            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
 
            ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['conntrackt.Project'])),
 
            ('location', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['conntrackt.Location'])),
 
        ))
 
        db.send_create_signal('conntrackt', ['Entity'])
 

	
 
        # Adding model 'Interface'
 
        db.create_table('conntrackt_interface', (
 
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
            ('name', self.gf('django.db.models.fields.CharField')(default='eth0', max_length=100)),
 
            ('description', self.gf('django.db.models.fields.TextField')(default='Main network interface.', blank=True)),
 
            ('entity', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['conntrackt.Entity'])),
 
            ('address', self.gf('django.db.models.fields.IPAddressField')(max_length=15)),
 
            ('netmask', self.gf('django.db.models.fields.IPAddressField')(default='255.255.255.255', max_length=15)),
 
        ))
 
        db.send_create_signal('conntrackt', ['Interface'])
 

	
 
        # Adding model 'Communication'
 
        db.create_table('conntrackt_communication', (
 
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
 
            ('source', self.gf('django.db.models.fields.related.ForeignKey')(related_name='source_set', to=orm['conntrackt.Interface'])),
 
            ('destination', self.gf('django.db.models.fields.related.ForeignKey')(related_name='destination_set', to=orm['conntrackt.Interface'])),
 
            ('protocol', self.gf('django.db.models.fields.CharField')(max_length=10)),
 
            ('port', self.gf('django.db.models.fields.IntegerField')(default=0)),
 
            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
 
        ))
 
        db.send_create_signal('conntrackt', ['Communication'])
 
from django.db import models, migrations
 
import conntrackt.models
 

	
 

	
 
    def backwards(self, orm):
 
        # Deleting model 'Project'
 
        db.delete_table('conntrackt_project')
 

	
 
        # Deleting model 'Location'
 
        db.delete_table('conntrackt_location')
 
class Migration(migrations.Migration):
 

	
 
        # Deleting model 'Entity'
 
        db.delete_table('conntrackt_entity')
 

	
 
        # Deleting model 'Interface'
 
        db.delete_table('conntrackt_interface')
 

	
 
        # Deleting model 'Communication'
 
        db.delete_table('conntrackt_communication')
 

	
 
    dependencies = [
 
    ]
 

	
 
    models = {
 
        'conntrackt.communication': {
 
            'Meta': {'object_name': 'Communication'},
 
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
 
            'destination': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'destination_set'", 'to': "orm['conntrackt.Interface']"}),
 
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
            'port': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
 
            'protocol': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
 
            'source': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source_set'", 'to': "orm['conntrackt.Interface']"})
 
        },
 
        'conntrackt.entity': {
 
            'Meta': {'object_name': 'Entity'},
 
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
 
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
            'location': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['conntrackt.Location']"}),
 
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
 
            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['conntrackt.Project']"})
 
        },
 
        'conntrackt.interface': {
 
            'Meta': {'object_name': 'Interface'},
 
            'address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
 
            'description': ('django.db.models.fields.TextField', [], {'default': "'Main network interface.'", 'blank': 'True'}),
 
            'entity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['conntrackt.Entity']"}),
 
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
            'name': ('django.db.models.fields.CharField', [], {'default': "'eth0'", 'max_length': '100'}),
 
            'netmask': ('django.db.models.fields.IPAddressField', [], {'default': "'255.255.255.255'", 'max_length': '15'})
 
        },
 
        'conntrackt.location': {
 
            'Meta': {'object_name': 'Location'},
 
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
 
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
 
        },
 
        'conntrackt.project': {
 
            'Meta': {'object_name': 'Project'},
 
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
 
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
 
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
 
        }
 
    }
 

	
 
    complete_apps = ['conntrackt']
 
\ No newline at end of file
 
    operations = [
 
        migrations.CreateModel(
 
            name='Communication',
 
            fields=[
 
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
 
                ('protocol', models.CharField(max_length=10, choices=[(b'TCP', b'TCP'), (b'UDP', b'UDP'), (b'ICMP', b'ICMP')])),
 
                ('port', models.IntegerField(default=0)),
 
                ('description', models.TextField(blank=True)),
 
            ],
 
            options={
 
            },
 
            bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
 
        ),
 
        migrations.CreateModel(
 
            name='Entity',
 
            fields=[
 
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
 
                ('name', models.CharField(max_length=100)),
 
                ('description', models.TextField(blank=True)),
 
            ],
 
            options={
 
                'verbose_name_plural': 'entities',
 
            },
 
            bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
 
        ),
 
        migrations.CreateModel(
 
            name='Interface',
 
            fields=[
 
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
 
                ('name', models.CharField(default=b'eth0', max_length=100)),
 
                ('description', models.TextField(default=b'Main network interface.', blank=True)),
 
                ('address', models.IPAddressField()),
 
                ('netmask', models.IPAddressField(default=b'255.255.255.255')),
 
                ('entity', models.ForeignKey(to='conntrackt.Entity')),
 
            ],
 
            options={
 
            },
 
            bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
 
        ),
 
        migrations.CreateModel(
 
            name='Location',
 
            fields=[
 
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
 
                ('name', models.CharField(unique=True, max_length=100)),
 
                ('description', models.TextField(blank=True)),
 
            ],
 
            options={
 
            },
 
            bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
 
        ),
 
        migrations.CreateModel(
 
            name='Project',
 
            fields=[
 
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
 
                ('name', models.CharField(unique=True, max_length=100)),
 
                ('description', models.TextField(blank=True)),
 
            ],
 
            options={
 
                'permissions': (('view', 'Can view information'),),
 
            },
 
            bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
 
        ),
 
        migrations.AlterUniqueTogether(
 
            name='interface',
 
            unique_together=set([('name', 'entity'), ('entity', 'address', 'netmask')]),
 
        ),
 
        migrations.AddField(
 
            model_name='entity',
 
            name='location',
 
            field=models.ForeignKey(to='conntrackt.Location'),
 
            preserve_default=True,
 
        ),
 
        migrations.AddField(
 
            model_name='entity',
 
            name='project',
 
            field=models.ForeignKey(to='conntrackt.Project'),
 
            preserve_default=True,
 
        ),
 
        migrations.AlterUniqueTogether(
 
            name='entity',
 
            unique_together=set([('name', 'project')]),
 
        ),
 
        migrations.AddField(
 
            model_name='communication',
 
            name='destination',
 
            field=models.ForeignKey(related_name='destination_set', to='conntrackt.Interface'),
 
            preserve_default=True,
 
        ),
 
        migrations.AddField(
 
            model_name='communication',
 
            name='source',
 
            field=models.ForeignKey(related_name='source_set', to='conntrackt.Interface'),
 
            preserve_default=True,
 
        ),
 
        migrations.AlterUniqueTogether(
 
            name='communication',
 
            unique_together=set([('source', 'destination', 'protocol', 'port')]),
 
        ),
 
    ]
conntrackt/migrations/0002_auto__add_unique_communication_source_destination_protocol_port.py
Show inline comments
 
deleted file
conntrackt/migrations/0003_auto__add_unique_entity_project_name__add_unique_location_name__add_un.py
Show inline comments
 
deleted file
conntrackt/migrations/0004_auto__add_unique_interface_netmask_address_entity.py
Show inline comments
 
deleted file
docs/releasenotes.rst
Show inline comments
 
@@ -15,6 +15,13 @@ Release Notes
 
dev
 
---
 

	
 
Breaking changes:
 

	
 
* Django Conntrackt now depends on Django 1.7. In addition to official
 
  Django documentation, there is a dedicated upgrade guide that deals
 
  with the most basic installation.
 
  [ `CONNT-25 <https://projects.majic.rs/conntrackt/issues/CONNT-30>`_ ]
 

	
 
New features/improvements:
 

	
 
* Updated jQuery used internally to version 3.2.1.
requirements/base.in
Show inline comments
 
@@ -24,7 +24,7 @@ django-braces~=1.12.0
 
django-crispy-forms~=1.6.0
 

	
 
# Web framework used by application.
 
django~=1.6.0
 
django~=1.7.0
 

	
 
# Library for programatic calculation of colours (contrasts,
 
# inversions etc).
 
@@ -32,6 +32,3 @@ palette~=0.2.0
 

	
 
# Interaface towards Graphviz for chart generation.
 
pydot~=1.2.0
 

	
 
# Library for data migration in case of model changes.
 
south~=1.0.0
requirements/development.txt
Show inline comments
 
@@ -2,7 +2,7 @@
 
# This file is autogenerated by pip-compile
 
# To update, run:
 
#
 
#    pip-compile --output-file ./requirements/development.txt ./requirements/development.in
 
#    pip-compile --output-file requirements/development.txt requirements/development.in
 
#
 
alabaster==0.7.10         # via sphinx
 
babel==2.5.1              # via sphinx
 
@@ -11,7 +11,7 @@ chardet==3.0.4            # via requests
 
coverage==4.4.2
 
django-braces==1.12.0
 
django-crispy-forms==1.6.1
 
django==1.6.11
 
django==1.7.11
 
docutils==0.14            # via sphinx
 
factory-boy==2.1.2
 
funcsigs==1.0.2           # via mock
 
@@ -29,7 +29,6 @@ pytz==2017.3
 
requests==2.18.4          # via sphinx
 
six==1.11.0               # via mock, sphinx
 
snowballstemmer==1.2.1    # via sphinx
 
south==1.0.2
 
sphinx==1.6.5
 
sphinxcontrib-websupport==1.0.1  # via sphinx
 
typing==3.6.2             # via sphinx
requirements/test.txt
Show inline comments
 
@@ -2,7 +2,7 @@
 
# This file is autogenerated by pip-compile
 
# To update, run:
 
#
 
#    pip-compile --output-file ./requirements/test.txt ./requirements/test.in
 
#    pip-compile --output-file requirements/test.txt requirements/test.in
 
#
 
alabaster==0.7.10         # via sphinx
 
babel==2.5.1              # via sphinx
 
@@ -11,7 +11,7 @@ chardet==3.0.4            # via requests
 
coverage==4.4.2
 
django-braces==1.12.0
 
django-crispy-forms==1.6.1
 
django==1.6.11
 
django==1.7.11
 
docutils==0.14            # via sphinx
 
factory-boy==2.1.2
 
funcsigs==1.0.2           # via mock
 
@@ -29,7 +29,6 @@ pytz==2017.3
 
requests==2.18.4          # via sphinx
 
six==1.11.0               # via mock, sphinx
 
snowballstemmer==1.2.1    # via sphinx
 
south==1.0.2
 
sphinx==1.6.5
 
sphinxcontrib-websupport==1.0.1  # via sphinx
 
typing==3.6.2             # via sphinx
setup.py
Show inline comments
 
@@ -26,10 +26,9 @@ README = open(os.path.join(os.path.dirna
 
INSTALL_REQUIREMENTS = [
 
    "django-braces~=1.12.0",
 
    "django-crispy-forms~=1.6.0",
 
    "django~=1.6.0",
 
    "django~=1.7.0",
 
    "palette~=0.2.0",
 
    "pydot~=1.2.0",
 
    "south~=1.0.0",
 
]
 

	
 
# allow setup.py to be run from any path
testproject/testproject/settings.py
Show inline comments
 
@@ -18,172 +18,102 @@
 
# Django Conntrackt.  If not, see <http://www.gnu.org/licenses/>.
 
#
 

	
 

	
 
# Django settings for testproject project.
 
DEBUG = True
 
TEMPLATE_DEBUG = DEBUG
 

	
 
ADMINS = (
 
    ('Branko Majic', 'branko@majic.rs'),
 
)
 

	
 
MANAGERS = ADMINS
 
"""
 
Django settings for testproject project.
 

	
 
DATABASES = {
 
    'default': {
 
        'ENGINE': 'django.db.backends.sqlite3',  # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
 
        'NAME': 'testproject.db',                      # Or path to database file if using sqlite3.
 
        'USER': '',                      # Not used with sqlite3.
 
        'PASSWORD': '',                  # Not used with sqlite3.
 
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
 
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
 
    }
 
}
 
For more information on this file, see
 
https://docs.djangoproject.com/en/1.7/topics/settings/
 

	
 
# Local time zone for this installation. Choices can be found here:
 
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 
# although not all choices may be available on all operating systems.
 
# In a Windows environment this must be set to your system time zone.
 
TIME_ZONE = 'Europe/Stockholm'
 

	
 
# Language code for this installation. All choices can be found here:
 
# http://www.i18nguy.com/unicode/language-identifiers.html
 
LANGUAGE_CODE = 'en-us'
 

	
 
SITE_ID = 1
 

	
 
# If you set this to False, Django will make some optimizations so as not
 
# to load the internationalization machinery.
 
USE_I18N = True
 
For the full list of settings and their values, see
 
https://docs.djangoproject.com/en/1.7/ref/settings/
 
"""
 

	
 
# If you set this to False, Django will not format dates, numbers and
 
# calendars according to the current locale.
 
USE_L10N = True
 

	
 
# If you set this to False, Django will not use timezone-aware datetimes.
 
USE_TZ = True
 
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 
import os
 
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
 

	
 
# Absolute filesystem path to the directory that will hold user-uploaded files.
 
# Example: "/home/media/media.lawrence.com/media/"
 
MEDIA_ROOT = ''
 

	
 
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
 
# trailing slash.
 
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
 
MEDIA_URL = ''
 

	
 
# Absolute path to the directory static files should be collected to.
 
# Don't put anything in this directory yourself; store your static files
 
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
 
# Example: "/home/media/media.lawrence.com/static/"
 
STATIC_ROOT = ''
 

	
 
# URL prefix for static files.
 
# Example: "http://media.lawrence.com/static/"
 
STATIC_URL = '/static/'
 
# Quick-start development settings - unsuitable for production
 
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
 

	
 
# Additional locations of static files
 
STATICFILES_DIRS = (
 
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
 
    # Always use forward slashes, even on Windows.
 
    # Don't forget to use absolute paths, not relative paths.
 
)
 

	
 
# List of finder classes that know how to find static files in
 
# various locations.
 
STATICFILES_FINDERS = (
 
    'django.contrib.staticfiles.finders.FileSystemFinder',
 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
 
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
 
)
 

	
 
# Make this unique, and don't share it with anybody.
 
# SECURITY WARNING: keep the secret key used in production secret!
 
SECRET_KEY = '%s-x^wskhxu#5%o)0ck71g7o@7p18has!9_#(h(f@j@$97pcaw'
 

	
 
# List of callables that know how to import templates from various sources.
 
TEMPLATE_LOADERS = (
 
    'django.template.loaders.filesystem.Loader',
 
    'django.template.loaders.app_directories.Loader',
 
#     'django.template.loaders.eggs.Loader',
 
# 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',
 
     # Enable the conntrackt application
 
     'conntrackt',
 
     # Generic mixins for Django.
 
     'braces',
 
     # Better forms, including styling functions.
 
     'crispy_forms',
 
)
 

	
 
MIDDLEWARE_CLASSES = (
 
    'django.contrib.sessions.middleware.SessionMiddleware',
 
    'django.middleware.common.CommonMiddleware',
 
    'django.contrib.sessions.middleware.SessionMiddleware',
 
    'django.middleware.csrf.CsrfViewMiddleware',
 
    'django.contrib.auth.middleware.AuthenticationMiddleware',
 
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 
    'django.contrib.messages.middleware.MessageMiddleware',
 
    # Uncomment the next line for simple clickjacking protection:
 
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
 
)
 

	
 
ROOT_URLCONF = 'testproject.urls'
 

	
 
# Python dotted path to the WSGI application used by Django's runserver.
 
WSGI_APPLICATION = 'testproject.wsgi.application'
 

	
 
TEMPLATE_DIRS = (
 
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
 
    # Always use forward slashes, even on Windows.
 
    # Don't forget to use absolute paths, not relative paths.
 
)
 

	
 
# Database
 
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
 

	
 
DATABASES = {
 
    'default': {
 
        'ENGINE': 'django.db.backends.sqlite3',
 
        'NAME': os.path.join(BASE_DIR, 'testproject.db'),
 
    }
 
}
 

	
 
# Internationalization
 
# https://docs.djangoproject.com/en/1.7/topics/i18n/
 

	
 
LANGUAGE_CODE = 'en-us'
 

	
 
# Extend the default TEMPLATE_CONTEXT_PROCESSORS
 
TIME_ZONE = 'Europe/Stockholm'
 

	
 
USE_I18N = True
 

	
 
USE_L10N = True
 

	
 
USE_TZ = True
 

	
 

	
 
# Static files (CSS, JavaScript, Images)
 
# https://docs.djangoproject.com/en/1.7/howto/static-files/
 

	
 
STATIC_URL = '/static/'
 

	
 
# Extend the default TEMPLATE_CONTEXT_PROCESSORS to include the
 
# request as part of context (used throughout tests).
 
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
 
TEMPLATE_CONTEXT_PROCESSORS += (
 
    "django.core.context_processors.request",
 
    )
 

	
 

	
 
INSTALLED_APPS = (
 
    'django.contrib.auth',
 
    'django.contrib.contenttypes',
 
    'django.contrib.sessions',
 
    'django.contrib.sites',
 
    'django.contrib.messages',
 
    'django.contrib.staticfiles',
 
    # Uncomment the next line to enable the admin:
 
    'django.contrib.admin',
 
    # Uncomment the next line to enable admin documentation:
 
    # 'django.contrib.admindocs',
 
    # Enable the conntrackt application
 
    'conntrackt',
 
    # Database migrations
 
    'south',
 
    # Generic mixins for Django.
 
    'braces',
 
    # Better forms, including styling functions.
 
    'crispy_forms',
 
)
 

	
 
# A sample logging configuration. The only tangible logging
 
# performed by this configuration is to send an email to
 
# the site admins on every HTTP 500 error when DEBUG=False.
 
# See http://docs.djangoproject.com/en/dev/topics/logging for
 
# more details on how to customize your logging configuration.
 
LOGGING = {
 
    'version': 1,
 
    'disable_existing_loggers': False,
 
    'filters': {
 
        'require_debug_false': {
 
            '()': 'django.utils.log.RequireDebugFalse'
 
        }
 
    },
 
    'handlers': {
 
        'mail_admins': {
 
            'level': 'ERROR',
 
            'filters': ['require_debug_false'],
 
            'class': 'django.utils.log.AdminEmailHandler'
 
        }
 
    },
 
    'loggers': {
 
        'django.request': {
 
            'handlers': ['mail_admins'],
 
            'level': 'ERROR',
 
            'propagate': True,
 
        },
 
    }
 
}
 

	
 
# View that should be called for log-in action.
 
LOGIN_URL = "login"
testproject/testproject/urls.py
Show inline comments
 
@@ -24,23 +24,14 @@ from django.conf.urls import patterns, i
 
from django.contrib import admin
 
from django.http import HttpResponseRedirect
 

	
 

	
 
# Auto-discover admin interface.
 
admin.autodiscover()
 

	
 

	
 
urlpatterns = patterns(
 
    '',
 
    # Examples:
 
    # url(r'^$', 'testproject.views.home', name='home'),
 
    # url(r'^testproject/', include('testproject.foo.urls')),
 
    # url(r'^blog/', include('blog.urls')),
 

	
 
    url(r'^$', lambda r: HttpResponseRedirect('conntrackt/')),
 
    url(r'^conntrackt/', include('conntrackt.urls')),
 

	
 

	
 
    # Uncomment the admin/doc line below to enable admin documentation:
 
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
 

	
 
    # Uncomment the next line to enable the admin:
 
    url(r'^admin/', include(admin.site.urls)),
 
)
testproject/testproject/wsgi.py
Show inline comments
 
@@ -18,32 +18,17 @@
 
# Django Conntrackt.  If not, see <http://www.gnu.org/licenses/>.
 
#
 

	
 

	
 
"""
 
WSGI config for testproject project.
 

	
 
This module contains the WSGI application used by Django's development server
 
and any production WSGI deployments. It should expose a module-level variable
 
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
 
this application via the ``WSGI_APPLICATION`` setting.
 
It exposes the WSGI callable as a module-level variable named ``application``.
 

	
 
Usually you will have the standard Django WSGI application here, but it also
 
might make sense to replace the whole Django WSGI application with a custom one
 
that later delegates to the Django one. For example, you could introduce WSGI
 
middleware here, or combine a Django application with an application of another
 
framework.
 
For more information on this file, see
 
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
 
"""
 

	
 
"""
 
import os
 

	
 
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testproject.settings")
 

	
 
# This application object is used by any WSGI server configured to use this
 
# file. This includes Django's development server, if the WSGI_APPLICATION
 
# setting points here.
 
from django.core.wsgi import get_wsgi_application
 
application = get_wsgi_application()
 

	
 
# Apply WSGI middleware here.
 
# from helloworld.wsgi import HelloWorldApplication
 
# application = HelloWorldApplication(application)
0 comments (0 inline, 0 general)