Commit e86ea3eb by Kálmán Viktor

pep8 fixes

parent 8dfd6606
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
from os import environ from os import environ
from os.path import abspath, basename, dirname, join, normpath from os.path import abspath, basename, dirname, join, normpath
from json import loads from json import loads
from socket import SOCK_STREAM # from socket import SOCK_STREAM
from sys import path from sys import path
# Normally you should not import ANYTHING from Django directly # Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception. # into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
def get_env_variable(var_name, default=None): def get_env_variable(var_name, default=None):
""" Get the environment variable or return exception/default """ """ Get the environment variable or return exception/default """
try: try:
...@@ -247,7 +248,7 @@ INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS ...@@ -247,7 +248,7 @@ INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
'disable_existing_loggers': False, 'disable_existing_loggers': False,
'formatters':{ 'formatters': {
'simple': { 'simple': {
'format': '%(asctime)s [%(levelname)s]: %(name)s %(message)s', 'format': '%(asctime)s [%(levelname)s]: %(name)s %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S', 'datefmt': '%Y-%m-%d %H:%M:%S',
......
"""Development settings and globals.""" """Development settings and globals."""
from os.path import join, normpath # from os.path import join, normpath
from base import * from base import *
...@@ -47,21 +47,23 @@ CACHES = { ...@@ -47,21 +47,23 @@ CACHES = {
########## TOOLBAR CONFIGURATION ########## TOOLBAR CONFIGURATION
# See: https://github.com/django-debug-toolbar/django-debug-toolbar#installation # https://github.com/django-debug-toolbar/django-debug-toolbar#installation
if get_env_variable('DJANGO_TOOLBAR', 'FALSE') == 'TRUE': if get_env_variable('DJANGO_TOOLBAR', 'FALSE') == 'TRUE':
INSTALLED_APPS += ( INSTALLED_APPS += (
'debug_toolbar', 'debug_toolbar',
) )
# See: https://github.com/django-debug-toolbar/django-debug-toolbar#installation # https://github.com/django-debug-toolbar/django-debug-toolbar#installation
INTERNAL_IPS = (get_env_variable('SSH_CLIENT', '127.0.0.1').split(' ')[0], ) INTERNAL_IPS = (
get_env_variable('SSH_CLIENT', '127.0.0.1').split(' ')[0],
)
# See: https://github.com/django-debug-toolbar/django-debug-toolbar#installation # https://github.com/django-debug-toolbar/django-debug-toolbar#installation
MIDDLEWARE_CLASSES += ( MIDDLEWARE_CLASSES += (
'debug_toolbar.middleware.DebugToolbarMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware',
) )
# See: https://github.com/django-debug-toolbar/django-debug-toolbar#installation # https://github.com/django-debug-toolbar/django-debug-toolbar#installation
DEBUG_TOOLBAR_CONFIG = { DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False, 'INTERCEPT_REDIRECTS': False,
'SHOW_TEMPLATE_CONTEXT': True, 'SHOW_TEMPLATE_CONTEXT': True,
......
...@@ -29,7 +29,7 @@ try: ...@@ -29,7 +29,7 @@ try:
except ImproperlyConfigured: except ImproperlyConfigured:
pass pass
else: else:
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password # https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password
EMAIL_HOST_PASSWORD = environ.get('EMAIL_HOST_PASSWORD', '') EMAIL_HOST_PASSWORD = environ.get('EMAIL_HOST_PASSWORD', '')
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user
...@@ -49,7 +49,6 @@ SERVER_EMAIL = EMAIL_HOST_USER ...@@ -49,7 +49,6 @@ SERVER_EMAIL = EMAIL_HOST_USER
########## END EMAIL CONFIGURATION ########## END EMAIL CONFIGURATION
########## CACHE CONFIGURATION ########## CACHE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches # See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
try: try:
......
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView # from django.views.generic import TemplateView
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns(
'',
#url(r'^$', TemplateView.as_view(template_name='base.html')), #url(r'^$', TemplateView.as_view(template_name='base.html')),
# Examples: # Examples:
......
...@@ -33,6 +33,7 @@ from django.core.wsgi import get_wsgi_application ...@@ -33,6 +33,7 @@ from django.core.wsgi import get_wsgi_application
_application = get_wsgi_application() _application = get_wsgi_application()
def application(environ, start_response): def application(environ, start_response):
# copy DJANGO_* wsgi-env vars to process-env # copy DJANGO_* wsgi-env vars to process-env
for i in environ.keys(): for i in environ.keys():
......
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, url
from .views import IndexView, VmDetailView from .views import IndexView, VmDetailView
urlpatterns = patterns('', urlpatterns = patterns(
'',
url(r'^$', IndexView.as_view()), url(r'^$', IndexView.as_view()),
url(r'^vm/\d+/$', VmDetailView.as_view()), url(r'^vm/\d+/$', VmDetailView.as_view()),
) )
...@@ -2,8 +2,8 @@ from django.views.generic import TemplateView ...@@ -2,8 +2,8 @@ from django.views.generic import TemplateView
class IndexView(TemplateView): class IndexView(TemplateView):
template_name="dashboard/index.html" template_name = "dashboard/index.html"
class VmDetailView(TemplateView): class VmDetailView(TemplateView):
template_name="dashboard/vm-detail.html" template_name = "dashboard/vm-detail.html"
...@@ -76,7 +76,6 @@ class Disk(TimeStampedModel): ...@@ -76,7 +76,6 @@ class Disk(TimeStampedModel):
'target_device': self.device_type + self.dev_num 'target_device': self.device_type + self.dev_num
} }
def to_json(self): def to_json(self):
self.base_name = self.base.name if self.base else None self.base_name = self.base.name if self.base else None
self.dir = self.datastore.path self.dir = self.datastore.path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment