Skip to content

Commit

Permalink
Update Makefile and fix flake8 offenses which were ignored before
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Sep 27, 2017
1 parent 96344f7 commit 5d2d91d
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 77 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install:
python setup.py install


FLAKE8_EXCLUDE=.git,tcms/settings,*sqls.py,urls.py,wsgi.py,*settings.py,*raw_sql.py,*xml2dict*
FLAKE8_EXCLUDE=.git,*raw_sql.py

.PHONY: flake8
flake8:
Expand Down Expand Up @@ -75,10 +75,12 @@ etags:
--exclude=build --exclude=tcms/static/js/lib -f TAGS

ifeq ($(DOCKER_ORG),)
DOCKER_ORG='mrsenko'
DOCKER_ORG='kiwitcms'
endif

KIWI_VERSION=$(shell cat tcms/__init__.py | grep __version__ | cut -f2 -d"'")
ifeq ($(KIWI_VERSION),)
KIWI_VERSION=$(shell cat tcms/__init__.py | grep __version__ | cut -f2 -d"'")
endif

docker-image:
docker build -t $(DOCKER_ORG)/kiwi:$(KIWI_VERSION) .
Expand Down
2 changes: 1 addition & 1 deletion tcms/profiles/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from django.conf.urls import include, url
from django.conf.urls import url
from django.urls import reverse_lazy
from django.contrib.auth import views as contrib_auth_views

Expand Down
22 changes: 10 additions & 12 deletions tcms/settings/common.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-

import django.conf.global_settings as DEFAULT_SETTINGS
import os.path
import tcms


#############################################################
### You have to override the following settings in product.py
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~ You have to override the following settings in product.py


# Set to False for production
Expand Down Expand Up @@ -47,8 +46,8 @@
EMAIL_SUBJECT_PREFIX = '[Kiwi-TCMS] '


###########################################################
### You may want to override the following settings as well
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~ You may want to override the following settings as well


# Hosts/domain names that are valid for this site; required if DEBUG is False
Expand Down Expand Up @@ -90,9 +89,8 @@
}



####################################
### Don't change the settings below.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~ DANGER: Don't change the settings below!

SITE_ID = 1

Expand Down Expand Up @@ -269,10 +267,10 @@

# actually now displayed in the help menu at the top!
FOOTER_LINKS = [
('https://github.com/kiwitcms/Kiwi/issues/new', 'Report an Issue'),
('http://kiwitcms.readthedocs.io/en/latest/tutorial.html', 'User guide'),
('http://kiwitcms.readthedocs.io/en/latest/guide/admin.html', 'Administration guide'),
('/xmlrpc/', 'XML-RPC service'),
('https://github.com/kiwitcms/Kiwi/issues/new', 'Report an Issue'),
('http://kiwitcms.readthedocs.io/en/latest/tutorial.html', 'User guide'),
('http://kiwitcms.readthedocs.io/en/latest/guide/admin.html', 'Administration guide'),
('/xmlrpc/', 'XML-RPC service'),
]


Expand Down
14 changes: 6 additions & 8 deletions tcms/settings/devel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Django settings for devel env.

from .product import *
import os
from .product import * # noqa: F403

# Debug settings
DEBUG = True
Expand All @@ -18,15 +19,12 @@
}

# django-debug-toolbar settings
MIDDLEWARE += [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]

INSTALLED_APPS += [
'debug_toolbar',
]
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware'] # noqa: F405

FILE_UPLOAD_DIR = os.path.join(TCMS_ROOT_PATH, '..', 'uploads')
INSTALLED_APPS += ['debug_toolbar'] # noqa: F405

FILE_UPLOAD_DIR = os.path.join(TCMS_ROOT_PATH, '..', 'uploads') # noqa: F405

# Needed by django.template.context_processors.debug:
# See http://docs.djangoproject.com/en/dev/ref/templates/api/#django-template-context-processors-debug
Expand Down
5 changes: 1 addition & 4 deletions tcms/settings/product.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Django settings for product env.

import os
from .common import *
from .common import * # noqa: F401,F403

# Debug settings
DEBUG = False


39 changes: 1 addition & 38 deletions tcms/settings/test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tcms.settings.devel import *
from tcms.settings.devel import * # noqa: F401,F403

DATABASES = {
'default': {
Expand All @@ -14,40 +14,3 @@
LISTENING_MODEL_SIGNAL = False

STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '[%(asctime)s] %(levelname)s %(message)s'
},
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'console':{
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
4 changes: 2 additions & 2 deletions tcms/settings/test/mysql.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from tcms.settings.test import *
from tcms.settings.test import * # noqa: F403

DATABASES['default'].update({
DATABASES['default'].update({ # noqa: F405
'ENGINE': 'django.db.backends.mysql',
'NAME': 'kiwi',
'USER': 'kiwi',
Expand Down
5 changes: 3 additions & 2 deletions tcms/settings/test/postgresql.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from tcms.settings.test import *
from tcms.settings.test import * # noqa: F403

DATABASES['default'].update({

DATABASES['default'].update({ # noqa: F405
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'kiwi',
'USER': 'postgres',
Expand Down
13 changes: 8 additions & 5 deletions tcms/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

"""
WSGI config for tcms project.
WSGI config for Kiwi TCMS project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
Expand All @@ -15,7 +15,13 @@
framework.
"""

import os
import sys
from django.core.wsgi import get_wsgi_application

import tcms


# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
Expand All @@ -25,22 +31,19 @@
os.environ['PYTHON_EGG_CACHE'] = '/tmp/.python-eggs/'

# add tcms's core lib path
import tcms, sys
# tcms should exist in only one path.
sys.path.append(os.path.join(tcms.__path__[0], 'core', 'lib'))

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
_application = get_wsgi_application()


def application(environ, start_response):
environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO']
if environ['wsgi.url_scheme'] == 'https':
environ['HTTPS'] = 'on'

return _application(environ, start_response)

# Apply WSGI middleware here.
Expand Down
2 changes: 0 additions & 2 deletions tcms/xmlrpc/settings.py

This file was deleted.

0 comments on commit 5d2d91d

Please sign in to comment.