Adjust settings to silence warnings
This commit is contained in:
parent
0a906b944e
commit
67e47d24a8
26
example/app/migrations/0001_initial.py
Normal file
26
example/app/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9 on 2016-09-22 16:56
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import multiselectfield.db.fields
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Book',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=200)),
|
||||||
|
('categories', multiselectfield.db.fields.MultiSelectField(choices=[(1, 'Handbooks and manuals by discipline'), (2, 'Business books'), (3, 'Books of literary criticism'), (4, 'Books about literary theory'), (5, 'Books about literature')], default=1, max_length=9)),
|
||||||
|
('tags', multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('sex', 'Sex'), ('work', 'Work'), ('happy', 'Happy'), ('food', 'Food'), ('field', 'Field'), ('boring', 'Boring'), ('interesting', 'Interesting'), ('huge', 'huge'), ('nice', 'Nice')], max_length=54, null=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
0
example/app/migrations/__init__.py
Normal file
0
example/app/migrations/__init__.py
Normal file
|
@ -14,12 +14,27 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from django import VERSION
|
||||||
try:
|
try:
|
||||||
from django.conf.urls import include, patterns, url
|
from django.conf.urls import url
|
||||||
|
|
||||||
|
# Compatibility for Django > 1.8
|
||||||
|
def patterns(prefix, *args):
|
||||||
|
if VERSION < (1, 9):
|
||||||
|
from django.conf.urls import patterns as django_patterns
|
||||||
|
return django_patterns(prefix, *args)
|
||||||
|
elif prefix != '':
|
||||||
|
raise NotImplementedError("You need to update your URLConf for "
|
||||||
|
"Django 1.10, or tweak it to remove the "
|
||||||
|
"prefix parameter")
|
||||||
|
else:
|
||||||
|
return list(args)
|
||||||
except ImportError: # Django < 1.4
|
except ImportError: # Django < 1.4
|
||||||
from django.conf.urls.defaults import include, patterns, url
|
from django.conf.urls.defaults import patterns, url
|
||||||
|
|
||||||
|
from .views import app_index
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns('app.views',
|
urlpatterns = patterns('',
|
||||||
url(r'^$', 'app_index', name='app_index'),
|
url(r'^$', app_index, name='app_index'),
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
import os
|
import os
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
|
from django import VERSION
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
|
|
||||||
BASE_DIR = path.dirname(path.abspath(__file__))
|
BASE_DIR = path.dirname(path.abspath(__file__))
|
||||||
|
|
||||||
|
@ -105,13 +106,6 @@ STATICFILES_FINDERS = (
|
||||||
# Make this unique, and don't share it with anybody.
|
# Make this unique, and don't share it with anybody.
|
||||||
SECRET_KEY = 'lwfo1o9r^+x8xwec=6$a&m(dmg$1t%8)g6hr%&b4%)%_ualb8s'
|
SECRET_KEY = 'lwfo1o9r^+x8xwec=6$a&m(dmg$1t%8)g6hr%&b4%)%_ualb8s'
|
||||||
|
|
||||||
# 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',
|
|
||||||
)
|
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
@ -127,13 +121,23 @@ ROOT_URLCONF = 'example.urls'
|
||||||
# Python dotted path to the WSGI application used by Django's runserver.
|
# Python dotted path to the WSGI application used by Django's runserver.
|
||||||
WSGI_APPLICATION = 'example.wsgi.application'
|
WSGI_APPLICATION = 'example.wsgi.application'
|
||||||
|
|
||||||
TEMPLATE_DIRS = (
|
if VERSION < (1, 8):
|
||||||
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
|
||||||
|
# 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',
|
||||||
|
)
|
||||||
|
|
||||||
|
TEMPLATE_DIRS = (
|
||||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||||
# Always use forward slashes, even on Windows.
|
# Always use forward slashes, even on Windows.
|
||||||
# Don't forget to use absolute paths, not relative paths.
|
# Don't forget to use absolute paths, not relative paths.
|
||||||
)
|
)
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.core.context_processors.debug',
|
'django.core.context_processors.debug',
|
||||||
'django.core.context_processors.i18n',
|
'django.core.context_processors.i18n',
|
||||||
|
@ -142,7 +146,32 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
||||||
'django.core.context_processors.tz',
|
'django.core.context_processors.tz',
|
||||||
'django.core.context_processors.static',
|
'django.core.context_processors.static',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.core.context_processors.debug',
|
||||||
|
'django.core.context_processors.i18n',
|
||||||
|
'django.core.context_processors.media',
|
||||||
|
'django.core.context_processors.request',
|
||||||
|
'django.core.context_processors.tz',
|
||||||
|
'django.core.context_processors.static',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
'debug': DEBUG,
|
||||||
|
'loaders': [
|
||||||
|
# List of callables that know how to import templates from
|
||||||
|
# various sources.
|
||||||
|
'django.template.loaders.filesystem.Loader',
|
||||||
|
'django.template.loaders.app_directories.Loader',
|
||||||
|
]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
|
@ -198,10 +227,7 @@ LOGGING = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import django
|
if VERSION >= (1, 4):
|
||||||
|
|
||||||
if django.VERSION[0] == 1 and django.VERSION[1] >= 4:
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.tz',)
|
|
||||||
LOGGING['filters'] = {
|
LOGGING['filters'] = {
|
||||||
'require_debug_false': {
|
'require_debug_false': {
|
||||||
'()': 'django.utils.log.RequireDebugFalse',
|
'()': 'django.utils.log.RequireDebugFalse',
|
||||||
|
@ -209,5 +235,5 @@ if django.VERSION[0] == 1 and django.VERSION[1] >= 4:
|
||||||
}
|
}
|
||||||
LOGGING['handlers']['mail_admins']['filters'] = ['require_debug_false']
|
LOGGING['handlers']['mail_admins']['filters'] = ['require_debug_false']
|
||||||
|
|
||||||
if django.VERSION >= (1, 6):
|
if VERSION >= (1, 6):
|
||||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||||
|
|
|
@ -14,14 +14,27 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from django import VERSION
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
try:
|
try:
|
||||||
from django.conf.urls import include, patterns, url
|
from django.conf.urls import include, url
|
||||||
|
|
||||||
|
# Compatibility for Django > 1.8
|
||||||
|
def patterns(prefix, *args):
|
||||||
|
if VERSION < (1, 9):
|
||||||
|
from django.conf.urls import patterns as django_patterns
|
||||||
|
return django_patterns(prefix, *args)
|
||||||
|
elif prefix != '':
|
||||||
|
raise NotImplementedError("You need to update your URLConf for "
|
||||||
|
"Django 1.10, or tweak it to remove the "
|
||||||
|
"prefix parameter")
|
||||||
|
else:
|
||||||
|
return list(args)
|
||||||
except ImportError: # Django < 1.4
|
except ImportError: # Django < 1.4
|
||||||
from django.conf.urls.defaults import include, patterns, url
|
from django.conf.urls.defaults import include, patterns, url
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.views.static import serve
|
||||||
|
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
|
@ -30,13 +43,12 @@ js_info_dict = {
|
||||||
}
|
}
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^', include('example.app.urls')),
|
url(r'^', include('app.urls')),
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns += patterns('',
|
urlpatterns += patterns('',
|
||||||
(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
|
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
|
||||||
'django.views.static.serve',
|
serve,
|
||||||
{'document_root': settings.MEDIA_ROOT,
|
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
|
||||||
'show_indexes': True}),
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue