Skip to content

Commit

Permalink
Merge pull request #1 from wooyek/feature/locales
Browse files Browse the repository at this point in the history
Feature/locales
  • Loading branch information
wooyek committed Nov 24, 2017
2 parents 3fb1206 + 87e677e commit 7eca7b0
Show file tree
Hide file tree
Showing 28 changed files with 311 additions and 207 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ before_install:

install:
- pip install -r requirements/development.txt coveralls tox-travis
- pip install .
- virtualenv --version
- easy_install --version
- pip --version
Expand Down
13 changes: 9 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ include *.json
include Procfile
include .env Pipfile Pipfile.lock

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-exclude * .eggs .tox .tmp

recursive-include .github *.*
recursive-include requirements *.*
recursive-include src *.html *.png *.gif *js *.css *jpg *jpeg *svg *py
Expand All @@ -36,12 +40,14 @@ recursive-include src *.js
recursive-include src *.csv
recursive-include src .gitignore
recursive-include src *.env
recursive-include src *.cfg
recursive-include src *.po
recursive-include src *.pot
recursive-include bin * *.*
recursive-include tests *.env
recursive-include tests *.py
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-exclude * .eggs .tox .tmp

exclude example_project/.idea/workspace.xml
recursive-include example_project *.html
recursive-include example_project *.md
recursive-include example_project *.py
Expand All @@ -51,4 +57,3 @@ recursive-include example_project .gitignore
recursive-exclude example_project/.eggs *.*
recursive-include example_project *.iml
recursive-include example_project *.xml
exclude example_project/.idea/workspace.xml
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ clean-test: ## remove test and coverage artifacts
rm -fr htmlcov/

isort:
isort --verbose --recursive src tests setup.py
isort --verbose --recursive src tests example_project setup.py

lint: ## check style with flake8
flake8 src tests setup.py manage.py
isort --verbose --check-only --diff --recursive src tests setup.py
isort --verbose --check-only --diff --recursive src tests example_project setup.py
python setup.py check --strict --metadata --restructuredtext
check-manifest --ignore .idea,.idea/* .

Expand Down Expand Up @@ -122,3 +122,9 @@ release: sync bump publish ## build new package version release then upload to p
git merge master --verbose
git push origin develop --verbose
git push origin master --verbose

locales:
# https://docs.djangoproject.com/en/1.11/ref/django-admin/#django-admin-makemessages
python manage.py makemessages -v 3 --no-wrap --locale=pl_PL
python manage.py compilemessages -v 3

19 changes: 10 additions & 9 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ url = "https://pypi.python.org/simple"

[dev-packages]

Django = "*"
django = "*"
django-bootstrap-form = "*"
django-import-export = "*"
django-pascal-templates = "*"
django-powerbank = "*"
Markdown = "*"
markdown = "*"
pathlib = "*"
sparkpost = "*"
mock = "*"
pytest = "*"
pytest-xdist = "*"
pytest-html = "*"
pytest-django = "*"
factory_boy = "*"
factory-boy = "*"
"psycopg2" = "*"
django-environ = "*"
"bump2version" = "*"
Expand All @@ -30,26 +30,27 @@ coverage = "*"
"flake8" = "*"
invoke = "*"
isort = "*"
Pygments = "*"
readme_renderer = "*"
pygments = "*"
readme-renderer = "*"
tox = "*"
Sphinx = ">=1.6.5"
sphinx_rtd_theme = "*"
sphinx = ">=1.6.5"
sphinx-rtd-theme = "*"
docutils = "==0.13.1"
sphinxcontrib-spelling = "*"
pyenchant = "*"
"drwm0dfi" = {path = ".", editable = true}
click = "*"
detox = "*"
"6844dd9" = {file = "file:///data/work/wooyek/django-opt-out/example_project"}


[packages]

Django = "*"
django = "*"
django-bootstrap-form = "*"
django-import-export = "*"
django-pascal-templates = "*"
django-powerbank = "*"
Markdown = "*"
markdown = "*"
pathlib = "*"
click = "*"
28 changes: 12 additions & 16 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions example_project/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# and this example in editable mode
# NOTE: paths are realative to CWD and not this file parent folder
# Running pip install -r example_project/requiremenst.txt
-e ..
-e .
-r ../requirements/optional.txt

# This example requirements that may not not be already included in the app requirements
django
Expand Down
13 changes: 10 additions & 3 deletions example_project/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@

import os
import re
import uuid
from glob import glob
from os.path import basename, splitext

from pip.req import parse_requirements

try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
install_requires = parse_requirements(
os.path.join(os.path.dirname(__file__), "requirements.txt"),
session=uuid.uuid1()
)


def get_version(*file_paths):
"""Retrieves the version from path"""
filename = os.path.join(os.path.dirname(os.path.dirname(__file__)), *file_paths)
filename = os.path.join(os.path.dirname(__file__), *file_paths)
print("Looking for version in: {}".format(filename))
version_file = open(filename).read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
Expand All @@ -25,7 +32,7 @@ def get_version(*file_paths):
raise RuntimeError('Unable to find version string.')


version = get_version("src", "django_opt_out", "__init__.py")
version = get_version("src", "website", "__init__.py")

setup(
name='django-opt-out-example',
Expand All @@ -39,7 +46,7 @@ def get_version(*file_paths):
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
include_package_data=True,
install_requires=['django', 'django-environ'],
install_requires=[str(r.req) for r in install_requires] + ['Django>=1.10'],
license="MIT license",
zip_safe=False,
keywords='django-opt-out-example',
Expand Down
Empty file.
1 change: 0 additions & 1 deletion example_project/src/example_app/admin.py

This file was deleted.

5 changes: 0 additions & 5 deletions example_project/src/example_app/apps.py

This file was deleted.

1 change: 0 additions & 1 deletion example_project/src/example_app/models.py

This file was deleted.

1 change: 0 additions & 1 deletion example_project/src/example_app/tests.py

This file was deleted.

1 change: 0 additions & 1 deletion example_project/src/example_app/views.py

This file was deleted.

3 changes: 3 additions & 0 deletions example_project/src/website/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__author__ = """Janusz Skonieczny"""
__email__ = 'js+pypi@bravelabs.pl'
__version__ = '0.1.11'
14 changes: 13 additions & 1 deletion example_project/src/website/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
"""

from __future__ import absolute_import, unicode_literals
import os

import logging
import os
import socket
from pathlib import Path

import environ

logging.basicConfig(format='%(asctime)s %(levelname)-7s %(thread)-5d %(filename)s:%(lineno)s | %(funcName)s | %(message)s', datefmt='%H:%M:%S')
Expand Down Expand Up @@ -175,6 +177,16 @@
USE_L10N = True
USE_TZ = True

# https://docs.djangoproject.com/en/1.9/topics/i18n/translation/#how-django-discovers-language-preference
import django_powerbank # noqa F402 isort:skip
import django_opt_out # noqa F402 isort:skip

LOCALE_PATHS = [
str(Path(django_opt_out.__file__).parent / 'locales'),
str(BASE_DIR / 'locale'),
str(Path(django_powerbank.__file__).parent / 'locales'),
]

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/

Expand Down
2 changes: 1 addition & 1 deletion example_project/src/website/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# This will read missing environment variables from a file
# We want to do this before loading any base settings as they may depend on environment
environ.Env.read_env(str(Path(__file__).parent / "local.env"), DEBUG='True')
from .base import * # noqa: F402, F403
from .base import * # noqa: F402, F403 isort:skip

# https://docs.djangoproject.com/en/1.6/topics/email/#console-backend
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Expand Down
2 changes: 1 addition & 1 deletion example_project/src/website/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
environ.Env.read_env(str(evironment_config))

# noinspection PyUnresolvedReferences
from .base import * # noqa: F402, F403
from .base import * # noqa: F402, F403 isort:skip

LOGGING['handlers']['console']['formatter'] = 'heroku' # noqa: F405
LOGGING['handlers']['file'] = { # noqa: F405
Expand Down
2 changes: 1 addition & 1 deletion example_project/src/website/settings/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
environ.Env.read_env(str(evironment_config))

# noinspection PyUnresolvedReferences
from .base import * # noqa: F402, F403, F401
from .base import * # noqa: F402, F403, F401 isort:skip
2 changes: 1 addition & 1 deletion example_project/src/website/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic.base import TemplateView

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
click==6.7 --hash=sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d --hash=sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b
diff-match-patch==20121119 --hash=sha256:9dba5611fbf27893347349fd51cc1911cb403682a7163373adacc565d11e2e4c
django==1.11.7 --hash=sha256:75ce405d60f092f6adf904058d023eeea0e6d380f8d9c36134bac73da736023d --hash=sha256:8918e392530d8fc6965a56af6504229e7924c27265893f3949aa0529cd1d4b99
django-bootstrap-form==3.3 --hash=sha256:2edeb528bcdd0de454575ca84be06e15130baf286b9d302eacbd893cbf691b94
django-import-export==0.6.0 --hash=sha256:3e53b1cf5226fea2cecb9915f445ae2ed905f0de0d7f18148a60f98ff3446a86
django-localflavor==1.6 --hash=sha256:8002485fdeda5023aa572927489601a19acf63e34c2a738f0984cf2bac5b54a2
django-pascal-templates==0.8.11 --hash=sha256:bbccf916d60353348bd9948bb5f54ae2dd7bac70272e4ecca277ca5c3824c339
django-powerbank==0.2.27 --hash=sha256:562dad51e7555ea8f1272e3fe30c130bffe7bfc255a7dd74fe198c69da551549 --hash=sha256:be6e5e6d3793f0f8251eb896c2e796f7464bd2c74dcfe5ae88f7eca935c02090
django==1.11.7 --hash=sha256:75ce405d60f092f6adf904058d023eeea0e6d380f8d9c36134bac73da736023d --hash=sha256:8918e392530d8fc6965a56af6504229e7924c27265893f3949aa0529cd1d4b99
enum34==1.1.6 --hash=sha256:6bd0f6ad48ec2aa117d3d141940d484deccda84d4fcd884f5c3d93c23ecd8c79 --hash=sha256:644837f692e5f550741432dd3f223bbb9852018674981b1664e5dc339387588a --hash=sha256:8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1 --hash=sha256:2d81cbbe0e73112bdfe6ef8576f2238f2ba27dd0d55752a776c41d38b7da2850
et-xmlfile==1.0.1 --hash=sha256:614d9722d572f6246302c4491846d2c393c199cfa4edc9af593437691683335b
jdcal==1.3 --hash=sha256:b760160f8dc8cc51d17875c6b663fafe64be699e10ce34b6a95184b5aa0fdc9e
Expand Down
3 changes: 2 additions & 1 deletion requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# We want to install (not modifiy PYTHONPATH) local package in editable mode
# pipenv has issues with such installation, we will have to perform it manually
# https://github.com/kennethreitz/pipenv/issues/540
# -e .
-e .
-e example_project

# Tooling
-r tooling.txt
Expand Down

0 comments on commit 7eca7b0

Please sign in to comment.