Skip to content

Commit

Permalink
Merge pull request #13 from flaeppe/develop
Browse files Browse the repository at this point in the history
Local settings improvements, together with debug toolbar fixes
  • Loading branch information
kjagiello authored Feb 8, 2017
2 parents deb2018 + efdf70e commit d9bbc7c
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ python:
- "3.4"

install:
- pip install -r requirements.txt
- pip install flake8
- pip install -r requirements/test.txt

env:
matrix:
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
.PHONY: test clean
.PHONY: test clean install_requirements setup lint

help:
@echo 'Available targets:'
@echo ' lint Checks the codebase against PEP8 style convention.'
@echo ' test Runs all the tests in the project.'
@echo ' clean Removes *.pyc files.'
@echo ' install_requirements Installs local requirements for the project.'
@echo ' setup Installs requirements and runs project tests.'

lint:
cd src && flake8 --exclude=migrations,settings .

test:
cd src && python manage.py test --settings=foobar.settings.test

install_requirements:
pip install -r requirements/local.txt

setup: install_requirements test

clean:
find . -name "*.pyc" | xargs rm
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Django==1.10.5
-r requirements/common.txt
-r requirements/production.txt
5 changes: 0 additions & 5 deletions requirements/common.txt → requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
django-bananas==1.0.8
django-enumfields==0.8.2
django-factory-boy==0.1.6
django-model-utils==2.2
git+https://github.com/disqus/django-bitfield.git@306ba5#egg=django-bitfield
git+https://github.com/kjagiello/django-money.git@45ea5e#egg=django-money
djangorestframework==3.5.3
django-rest-swagger==2.1.1
factory-boy==2.5.2
Pillow==2.9.0
pluggy==0.3.0
py==1.4.30
py-moneyed==0.5.0
pyflakes==0.8.1
six==1.9.0
tox==2.1.1
requests==2.8.1
pytz==2015.7
psycopg2==2.6.1
raven==5.8.1
3 changes: 3 additions & 0 deletions requirements/local.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-r test.txt
Django==1.10.5
django-debug-toolbar==1.6
3 changes: 3 additions & 0 deletions requirements/production.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-r base.txt
Django==1.10.5
psycopg2==2.6.1
6 changes: 6 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-r base.txt
django-factory-boy==0.1.6
factory-boy==2.5.2
tox==2.1.1
pyflakes==0.8.1
flake8==3.3.0
2 changes: 1 addition & 1 deletion src/foobar/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
from bananas.url import database_conf_from_url
default_db = 'sqlite3://{}'.format(os.path.join(BASE_DIR, 'db.sqlite3'))
default_db = 'sqlite3:///db.sqlite3'
db_config = database_conf_from_url(os.getenv('DJANGO_DB', default_db))

DATABASES = {
Expand Down
7 changes: 6 additions & 1 deletion src/foobar/settings/local.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
from .base import * # noqa
from .base import *
from bananas.url import database_conf_from_url

INTERNAL_IPS = ['127.0.0.1']
INSTALLED_APPS += ('debug_toolbar',)
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
10 changes: 10 additions & 0 deletions src/foobar/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin

Expand All @@ -19,3 +20,12 @@
foobar.views.account_for_card, name='account_for_card'),
url(r'^admin/', include(admin.site.urls)),
]

if settings.DEBUG:
try:
import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
except ImportError:
pass

0 comments on commit d9bbc7c

Please sign in to comment.