Installation de la Django Debug Toolbar pour l'environnement de DEV.
This commit is contained in:
		@@ -11,7 +11,6 @@ https://docs.djangoproject.com/en/1.11/ref/settings/
 | 
			
		||||
"""
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 | 
			
		||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 | 
			
		||||
 | 
			
		||||
@@ -19,7 +18,7 @@ DEBUG = False
 | 
			
		||||
 | 
			
		||||
# Application definition
 | 
			
		||||
 | 
			
		||||
INSTALLED_APPS = [
 | 
			
		||||
INSTALLED_APPS = (
 | 
			
		||||
    'django.contrib.admin',
 | 
			
		||||
    'django.contrib.auth',
 | 
			
		||||
    'django.contrib.contenttypes',
 | 
			
		||||
@@ -30,10 +29,9 @@ INSTALLED_APPS = [
 | 
			
		||||
    'corsheaders',
 | 
			
		||||
    'core',
 | 
			
		||||
    'games.apps.GamesConfig',
 | 
			
		||||
    'figurines.apps.FigurinesConfig',
 | 
			
		||||
]
 | 
			
		||||
    'figurines.apps.FigurinesConfig', )
 | 
			
		||||
 | 
			
		||||
MIDDLEWARE = [
 | 
			
		||||
MIDDLEWARE = (
 | 
			
		||||
    'django.middleware.security.SecurityMiddleware',
 | 
			
		||||
    'django.contrib.sessions.middleware.SessionMiddleware',
 | 
			
		||||
    'django.middleware.locale.LocaleMiddleware',
 | 
			
		||||
@@ -42,8 +40,7 @@ MIDDLEWARE = [
 | 
			
		||||
    'django.middleware.csrf.CsrfViewMiddleware',
 | 
			
		||||
    'django.contrib.auth.middleware.AuthenticationMiddleware',
 | 
			
		||||
    'django.contrib.messages.middleware.MessageMiddleware',
 | 
			
		||||
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
 | 
			
		||||
]
 | 
			
		||||
    'django.middleware.clickjacking.XFrameOptionsMiddleware', )
 | 
			
		||||
 | 
			
		||||
ROOT_URLCONF = 'collection.urls'
 | 
			
		||||
 | 
			
		||||
@@ -70,16 +67,20 @@ WSGI_APPLICATION = 'collection.wsgi.application'
 | 
			
		||||
 | 
			
		||||
AUTH_PASSWORD_VALIDATORS = [
 | 
			
		||||
    {
 | 
			
		||||
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
 | 
			
		||||
        'NAME':
 | 
			
		||||
        'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
 | 
			
		||||
        'NAME':
 | 
			
		||||
        'django.contrib.auth.password_validation.MinimumLengthValidator',
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
 | 
			
		||||
        'NAME':
 | 
			
		||||
        'django.contrib.auth.password_validation.CommonPasswordValidator',
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
 | 
			
		||||
        'NAME':
 | 
			
		||||
        'django.contrib.auth.password_validation.NumericPasswordValidator',
 | 
			
		||||
    },
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@@ -90,4 +91,3 @@ STATIC_URL = '/static/'
 | 
			
		||||
STATIC_ROOT = os.path.join(os.path.abspath(os.path.curdir), 'static')
 | 
			
		||||
if os.getenv('STATIC_ROOT', None):
 | 
			
		||||
    STATIC_ROOT = os.path.abspath(os.getenv('STATIC_ROOT'))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
# Quick-start development settings - unsuitable for production
 | 
			
		||||
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
 | 
			
		||||
 | 
			
		||||
# SECURITY WARNING: keep the secret key used in production secret!
 | 
			
		||||
SECRET_KEY = 'tqma23#v!#ecse_gz_u(1oa6+x%1uyi718an9%nefqhi$0q_eg'
 | 
			
		||||
 | 
			
		||||
@@ -11,3 +10,9 @@ ALLOWED_HOSTS = ['*']
 | 
			
		||||
 | 
			
		||||
# CORS: allow all site to make cross site requests
 | 
			
		||||
CORS_ORIGIN_ALLOW_ALL = True
 | 
			
		||||
 | 
			
		||||
MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware', )
 | 
			
		||||
 | 
			
		||||
# Add Django debug toolbar
 | 
			
		||||
INSTALLED_APPS += ('debug_toolbar', )
 | 
			
		||||
INTERNAL_IPS = ['127.0.0.1']
 | 
			
		||||
 
 | 
			
		||||
@@ -13,18 +13,19 @@ Including another URLconf
 | 
			
		||||
    1. Import the include() function: from django.conf.urls import url, include
 | 
			
		||||
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
 | 
			
		||||
"""
 | 
			
		||||
from django.conf.urls import url, include
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
from django.conf.urls import include
 | 
			
		||||
from django.conf.urls import url
 | 
			
		||||
from django.contrib import admin
 | 
			
		||||
from collection import __version__ as app_version
 | 
			
		||||
from games.views import (
 | 
			
		||||
    GameList,
 | 
			
		||||
    GameViewSet,
 | 
			
		||||
    GameTimelineViewSet,
 | 
			
		||||
    PlatformViewSet,
 | 
			
		||||
)
 | 
			
		||||
from games.views import GameList
 | 
			
		||||
from games.views import GameTimelineViewSet
 | 
			
		||||
from games.views import GameViewSet
 | 
			
		||||
from games.views import PlatformViewSet
 | 
			
		||||
from rest_framework import routers
 | 
			
		||||
from rest_framework.documentation import include_docs_urls
 | 
			
		||||
 | 
			
		||||
from collection import __version__ as app_version
 | 
			
		||||
 | 
			
		||||
# Admin config
 | 
			
		||||
admin.site.site_title = 'OpenBackloggery'
 | 
			
		||||
admin.site.site_header = '%s %s' % (admin.site.site_title, app_version)
 | 
			
		||||
@@ -34,17 +35,21 @@ router = routers.DefaultRouter()
 | 
			
		||||
router.register(r'games', GameViewSet)
 | 
			
		||||
router.register(r'platforms', PlatformViewSet)
 | 
			
		||||
router.register(
 | 
			
		||||
    r'game_timelines',
 | 
			
		||||
    GameTimelineViewSet,
 | 
			
		||||
    base_name='game_timeline')
 | 
			
		||||
    r'game_timelines', GameTimelineViewSet, base_name='game_timeline')
 | 
			
		||||
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    url(r'^$', GameList.as_view(), name='homepage'),
 | 
			
		||||
    url(r'^games/', include('games.urls', namespace='games'), name='games'),
 | 
			
		||||
    url(r'^admin/', admin.site.urls),
 | 
			
		||||
    url(r'^api/v1/', include(router.urls), name='api'),
 | 
			
		||||
    url(r'^api/v1/docs/', include_docs_urls(title=' '.join(
 | 
			
		||||
        [admin.site.site_title,
 | 
			
		||||
        'API']))),
 | 
			
		||||
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
 | 
			
		||||
    url(r'^api/v1/docs/',
 | 
			
		||||
        include_docs_urls(title=' '.join([admin.site.site_title, 'API']))),
 | 
			
		||||
    url(r'^api-auth/',
 | 
			
		||||
        include('rest_framework.urls', namespace='rest_framework'))
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
if settings.DEBUG:
 | 
			
		||||
    import debug_toolbar
 | 
			
		||||
    urlpatterns = [
 | 
			
		||||
        url(r'^__debug__/', include(debug_toolbar.urls)),
 | 
			
		||||
    ] + urlpatterns
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
-r requirements.txt
 | 
			
		||||
django-debug-toolbar
 | 
			
		||||
flake8
 | 
			
		||||
pre-commit
 | 
			
		||||
pylint
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user