Skip to content

Commit

Permalink
enhenced the admin integration. fix package build.
Browse files Browse the repository at this point in the history
  • Loading branch information
darius BERNARD committed Feb 7, 2017
1 parent c35bef7 commit 026b633
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ install:
- if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then travis_retry pip install 'coverage<4.0'; fi
- pip install -r requirements.txt

before_script:
- isort --recursive --check-only --diff dynamic_logging testproject
- flake8 dynamic_logging testproject

# Command to run tests, e.g. python setup.py test
script:
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ include README.rst
include CONTRIBUTING.rst
include requirements.txt
include test_requirements.txt
recursive-include dynamic_logging/static *.js *.css
recursive-include dynamic_logging/templates *.html
1 change: 1 addition & 0 deletions dynamic_logging/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.utils.translation import ugettext_lazy as _

from dynamic_logging.scheduler import main_scheduler

from .models import Config, Trigger


Expand Down
1 change: 0 additions & 1 deletion dynamic_logging/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import threading
from collections import defaultdict
from contextlib import contextmanager
from functools import partial

logger = logging.getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion dynamic_logging/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.utils.timezone
from django.db import migrations, models

import dynamic_logging.models
import django.utils.timezone


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion dynamic_logging/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Meta:
]
get_latest_by = 'start_date'


def json_value(val):
try:
json.loads(val)
Expand All @@ -90,6 +91,7 @@ def json_value(val):
params={'value': val, 'error': str(e)},
)


@python_2_unicode_compatible
class Config(models.Model):
"""
Expand Down Expand Up @@ -137,7 +139,6 @@ def config(self, val):
if key in self.KEEPT_CONFIG
})


def apply(self, trigger=None):
"""
apply the current config to the global logging system.
Expand Down
1 change: 0 additions & 1 deletion dynamic_logging/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import functools
import logging
import threading
from threading import Thread

from django.utils import timezone

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
],
packages=[
'dynamic_logging',
'dynamic_logging.migrations',
'dynamic_logging.templatetags',
],
include_package_data=True,
license="GNU GENERAL PUBLIC LICENSE",
Expand Down
3 changes: 2 additions & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
teamcity-messages
pytz
pytz
django-debug-toolbar
15 changes: 10 additions & 5 deletions testproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@
}
}

TEST_RUNNER = "teamcity.django.TeamcityDjangoRunner"
try:
import teamcity
if teamcity.is_running_under_teamcity():
TEST_RUNNER = "teamcity.django.TeamcityDjangoRunner"
except ImportError:
pass

# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
Expand Down Expand Up @@ -159,21 +164,21 @@
},
'loggers': {
'django': {
'handlers': ['console'],
'handlers': ['null'],
'level': 'ERROR',
'propagate': True,
},
'django.request': {
'handlers': ['console'],
'handlers': ['null'],
'level': 'ERROR',
'propagate': True,
},
'testproject.testapp': {
'handlers': ['console', 'null', 'devnull'],
'handlers': ['null', 'devnull'],
'level': 'DEBUG',
'propagate': False
}
}
}

INTERNAL_IPS = ['127.0.0.1']
INTERNAL_IPS = ['127.0.0.1']
3 changes: 0 additions & 3 deletions testproject/testapp/admin.py

This file was deleted.

3 changes: 0 additions & 3 deletions testproject/testapp/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from django.db import models

# Create your models here.
1 change: 0 additions & 1 deletion testproject/testapp/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.contrib.auth import get_user_model
from django.test import TestCase


# Create your tests here.
from dynamic_logging.handlers import MockHandler
from dynamic_logging.models import Config
Expand Down
4 changes: 2 additions & 2 deletions testproject/testapp/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

from django.conf.urls import url, include
import debug_toolbar
from django.conf.urls import include, url

from . import views
import debug_toolbar

urlpatterns = [
url(r'^error401/$', views.error401),
Expand Down
7 changes: 0 additions & 7 deletions testproject/testapp/views.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import logging

from django.forms.forms import Form
from django.http.response import HttpResponse
from django.shortcuts import render


# Create your views here.
from django.views.generic.edit import FormView


def error401(request):
Expand All @@ -29,4 +23,3 @@ def log_somthing(request, level='debug', loggername=__name__):
logger = logging.getLogger(loggername)
logger.log(level, "message from view", extra={'level': level, 'loggername': loggername})
return HttpResponse("ok. logged to %s" % loggername)

16 changes: 16 additions & 0 deletions testproject/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for testproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testproject.settings")

application = get_wsgi_application()
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ basepython = python3
usedevelop = false
deps = flake8
changedir = {toxinidir}
commands = flake8 dynamic_logging
commands = flake8 dynamic_logging testproject


[testenv:isort]
basepython = python3
usedevelop = false
deps = isort
changedir = {toxinidir}
commands = isort --recursive --check-only --diff dynamic_logging
commands = isort --recursive --check-only --diff dynamic_logging testproject

0 comments on commit 026b633

Please sign in to comment.