From 10e3e8f6ab29b704ed2903fe53e04a18555dfab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awek=20Ehlert?= Date: Thu, 7 Aug 2014 21:10:26 +0200 Subject: [PATCH 1/2] add flake8 and setup.cfg for linting some changes to pass flake8 linting. added setup.cfg for flake8 configuration. Ignoring E265 can be added to this file because config/settings.py is flooded with this error. After #105 gets merged it'll be OK. --- {{cookiecutter.repo_name}}/requirements/test.txt | 1 + {{cookiecutter.repo_name}}/setup.cfg | 4 ++++ {{cookiecutter.repo_name}}/setup.py | 2 +- .../{{cookiecutter.repo_name}}/config/settings.py | 12 +++++------- .../{{cookiecutter.repo_name}}/config/urls.py | 3 +-- .../{{cookiecutter.repo_name}}/users/urls.py | 4 ++-- .../{{cookiecutter.repo_name}}/users/views.py | 4 ++-- 7 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 {{cookiecutter.repo_name}}/setup.cfg diff --git a/{{cookiecutter.repo_name}}/requirements/test.txt b/{{cookiecutter.repo_name}}/requirements/test.txt index bb78fde2..387f5dcd 100644 --- a/{{cookiecutter.repo_name}}/requirements/test.txt +++ b/{{cookiecutter.repo_name}}/requirements/test.txt @@ -1,3 +1,4 @@ # Test dependencies go here. -r base.txt coverage==3.7.1 +flake8==2.2.2 diff --git a/{{cookiecutter.repo_name}}/setup.cfg b/{{cookiecutter.repo_name}}/setup.cfg new file mode 100644 index 00000000..51059eda --- /dev/null +++ b/{{cookiecutter.repo_name}}/setup.cfg @@ -0,0 +1,4 @@ +[flake8] +#ignore = E265 +max-line-length = 120 +exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs diff --git a/{{cookiecutter.repo_name}}/setup.py b/{{cookiecutter.repo_name}}/setup.py index dba42c77..97e84b2e 100644 --- a/{{cookiecutter.repo_name}}/setup.py +++ b/{{cookiecutter.repo_name}}/setup.py @@ -23,7 +23,7 @@ setup( ], include_package_data=True, install_requires=[ - 'Django>=1.6.1', + 'Django>=1.6.5', ], zip_safe=False, scripts=['{{ cookiecutter.repo_name }}/manage.py'], diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py index 3aa76b8b..2aaf5122 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py @@ -173,9 +173,9 @@ class Common(Configuration): ) TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - ) + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + ) # See: http://django-crispy-forms.readthedocs.org/en/latest/install.html#template-packs CRISPY_TEMPLATE_PACK = 'bootstrap3' @@ -270,7 +270,6 @@ class Common(Configuration): } ########## END LOGGING CONFIGURATION - ########## Your common stuff: Below this line define 3rd party libary settings @@ -364,7 +363,7 @@ class Production(Common): AWS_EXPIREY = 60 * 60 * 24 * 7 AWS_HEADERS = { 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY, - AWS_EXPIREY) + AWS_EXPIREY) } # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url @@ -373,7 +372,7 @@ class Production(Common): ########## EMAIL DEFAULT_FROM_EMAIL = values.Value( - '{{cookiecutter.project_name}} ') + '{{cookiecutter.project_name}} ') EMAIL_HOST = values.Value('smtp.sendgrid.com') EMAIL_HOST_PASSWORD = values.SecretValue(environ_prefix="", environ_name="SENDGRID_PASSWORD") EMAIL_HOST_USER = values.SecretValue(environ_prefix="", environ_name="SENDGRID_USERNAME") @@ -405,4 +404,3 @@ class Production(Common): ########## END CACHING ########## Your production stuff: Below this line define 3rd party libary settings - diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/urls.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/urls.py index cf66e912..e7fa8c96 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/urls.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/urls.py @@ -11,7 +11,7 @@ from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', - url(r'^$', + url(r'^$', # noqa TemplateView.as_view(template_name='pages/home.html'), name="home"), url(r'^about/$', @@ -31,4 +31,3 @@ urlpatterns = patterns('', # Your stuff: custom urls go here ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) - diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/urls.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/urls.py index d3f24b51..061f54a1 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/urls.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/urls.py @@ -4,7 +4,7 @@ from django.conf.urls import patterns, url from users import views urlpatterns = patterns('', - # URL pattern for the UserListView + # URL pattern for the UserListView # noqa url( regex=r'^$', view=views.UserListView.as_view(), @@ -28,4 +28,4 @@ urlpatterns = patterns('', view=views.UserUpdateView.as_view(), name='update' ), -) \ No newline at end of file +) diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/views.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/views.py index 86d0a6a9..5b961fa3 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/views.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/views.py @@ -30,7 +30,7 @@ class UserRedirectView(LoginRequiredMixin, RedirectView): def get_redirect_url(self): return reverse("users:detail", - kwargs={"username": self.request.user.username}) + kwargs={"username": self.request.user.username}) class UserUpdateView(LoginRequiredMixin, UpdateView): @@ -43,7 +43,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView): # send the user back to their own page after a successful update def get_success_url(self): return reverse("users:detail", - kwargs={"username": self.request.user.username}) + kwargs={"username": self.request.user.username}) def get_object(self): # Only get the User record for the user making the request From 6da07492bda123c352d2187aec12fb86c4843424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awek=20Ehlert?= Date: Thu, 7 Aug 2014 21:27:50 +0200 Subject: [PATCH 2/2] added myself to CONTRIBUTORS.txt --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 3720cbf5..8855744b 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -26,6 +26,7 @@ Henrique G. G. Pereira / @ikkebr Travis McNeill / gh: Tavistock / @tavistock_esq Matt Linares Russell Davies +SÅ‚awek Ehlert / @slafs * Possesses commit rights