🚨 format python code using black
This commit is contained in:
1 parent
9c4a5b3d84
commit
a052397990
24 files changed
+643
-407
No files matched your search
+82
-86
@@ -1,5 +1,6 @@
|
||||
# Django settings for bbs project.
|
||||
import os
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
DEBUG = True
|
||||
@@ -10,92 +11,89 @@ ADMINS = (
|
||||
MANAGERS = ADMINS
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': 'db.sqlite3',
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": "db.sqlite3",
|
||||
},
|
||||
}
|
||||
|
||||
TIME_ZONE = 'Europe/Oslo'
|
||||
LANGUAGE_CODE = 'nb'
|
||||
TIME_ZONE = "Europe/Oslo"
|
||||
LANGUAGE_CODE = "nb"
|
||||
USE_I18N = True
|
||||
USE_L10N = True
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# Media and uploads
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
MEDIA_URL = "/media/"
|
||||
|
||||
# Static files
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
STATIC_URL = '/static/'
|
||||
STATICFILES_DIRS = (
|
||||
os.path.join(BASE_DIR, 'static'),
|
||||
)
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
||||
STATIC_URL = "/static/"
|
||||
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
|
||||
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
"django.contrib.staticfiles.finders.FileSystemFinder",
|
||||
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
||||
)
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = 'osv$uy-ea$*%lc)+xiwt5@2b7au%u*c!pa6hmh#vl)*+tp%fss'
|
||||
SECRET_KEY = "osv$uy-ea$*%lc)+xiwt5@2b7au%u*c!pa6hmh#vl)*+tp%fss"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
os.path.join(BASE_DIR, 'templates'),
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [
|
||||
os.path.join(BASE_DIR, "templates"),
|
||||
],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.template.context_processors.request',
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.i18n',
|
||||
'django.template.context_processors.media',
|
||||
'django.template.context_processors.static',
|
||||
'django.template.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.template.context_processors.request",
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.i18n",
|
||||
"django.template.context_processors.media",
|
||||
"django.template.context_processors.static",
|
||||
"django.template.context_processors.tz",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
]
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'bbssite.urls'
|
||||
ROOT_URLCONF = "bbssite.urls"
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.admin',
|
||||
|
||||
'widget_tweaks',
|
||||
'bootstrapform',
|
||||
'django_extensions',
|
||||
'rest_framework',
|
||||
'easy_thumbnails',
|
||||
'raven.contrib.django.raven_compat',
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.sites",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django.contrib.admin",
|
||||
"widget_tweaks",
|
||||
"bootstrapform",
|
||||
"django_extensions",
|
||||
"rest_framework",
|
||||
"easy_thumbnails",
|
||||
"raven.contrib.django.raven_compat",
|
||||
]
|
||||
LOCAL_APPS = [
|
||||
'main',
|
||||
"main",
|
||||
]
|
||||
INSTALLED_APPS += LOCAL_APPS
|
||||
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGIN_REDIRECT_URL = "/"
|
||||
|
||||
SESSION_COOKIE_AGE = 1209600 # 15 minutes
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||
@@ -105,54 +103,52 @@ BBS_LIMIT_DEPOSITS = False
|
||||
|
||||
# Thumbnails
|
||||
THUMBNAIL_ALIASES = {
|
||||
'': {
|
||||
'product': {'size': (64, 64), 'crop': True},
|
||||
"": {
|
||||
"product": {"size": (64, 64), "crop": True},
|
||||
},
|
||||
}
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'root': {
|
||||
'level': 'INFO',
|
||||
'handlers': ['console', 'sentry'],
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
"root": {
|
||||
"level": "INFO",
|
||||
"handlers": ["console", "sentry"],
|
||||
},
|
||||
'formatters': {
|
||||
'verbose': {
|
||||
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
|
||||
"formatters": {
|
||||
"verbose": {"format": "%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s"},
|
||||
},
|
||||
"handlers": {
|
||||
"sentry": {
|
||||
"level": "WARNING",
|
||||
"class": "raven.contrib.django.raven_compat.handlers.SentryHandler",
|
||||
},
|
||||
"console": {
|
||||
"level": "DEBUG",
|
||||
"class": "logging.StreamHandler",
|
||||
"formatter": "verbose",
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'sentry': {
|
||||
'level': 'WARNING',
|
||||
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
|
||||
"loggers": {
|
||||
"django.db.backends": {
|
||||
"level": "ERROR",
|
||||
"handlers": ["console"],
|
||||
"propagate": False,
|
||||
},
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'verbose'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django.db.backends': {
|
||||
'level': 'ERROR',
|
||||
'handlers': ['console'],
|
||||
'propagate': False,
|
||||
"raven": {
|
||||
"level": "WARNING",
|
||||
"handlers": ["console"],
|
||||
"propagate": False,
|
||||
},
|
||||
'raven': {
|
||||
'level': 'WARNING',
|
||||
'handlers': ['console'],
|
||||
'propagate': False,
|
||||
},
|
||||
'sentry.errors': {
|
||||
'level': 'WARNING',
|
||||
'handlers': ['console'],
|
||||
'propagate': False,
|
||||
"sentry.errors": {
|
||||
"level": "WARNING",
|
||||
"handlers": ["console"],
|
||||
"propagate": False,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
||||
|
||||
try:
|
||||
from .local_settings import *
|
||||
|
||||
+15
-8
@@ -11,17 +11,24 @@ from main import urls as main_urls
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = [
|
||||
re_path(r'', include(main_urls)),
|
||||
path('accounts/login/', LoginView.as_view(), name='django.contrib.auth.views.login'),
|
||||
path('accounts/logout/', LogoutView.as_view(), name='django.contrib.auth.views.logout'),
|
||||
|
||||
path('admin/', admin.site.urls),
|
||||
re_path(r"", include(main_urls)),
|
||||
path("accounts/login/", LoginView.as_view(), name="django.contrib.auth.views.login"),
|
||||
path(
|
||||
"accounts/logout/",
|
||||
LogoutView.as_view(),
|
||||
name="django.contrib.auth.views.logout",
|
||||
),
|
||||
path("admin/", admin.site.urls),
|
||||
]
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += [
|
||||
re_path(r'^media/(?P<path>.*)$', serve, {
|
||||
'document_root': settings.MEDIA_ROOT,
|
||||
})
|
||||
re_path(
|
||||
r"^media/(?P<path>.*)$",
|
||||
serve,
|
||||
{
|
||||
"document_root": settings.MEDIA_ROOT,
|
||||
},
|
||||
)
|
||||
]
|
||||
+1
-1
@@ -2,7 +2,7 @@ import os
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
from raven.contrib.django.middleware.wsgi import Sentry
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bbssite.settings')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bbssite.settings")
|
||||
|
||||
application = get_wsgi_application()
|
||||
application = Sentry(application)
|
||||
Reference in new issue
Block a user