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