Skip to content

Commit

Permalink
Merge branch 'master' of github.com:django-zero/django-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
hartym committed Jan 24, 2021
2 parents be6c122 + e404c20 commit 4b74b02
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 52 deletions.
4 changes: 2 additions & 2 deletions Makefile
@@ -1,4 +1,4 @@
# Generated by Medikit 0.8.0 on 2021-01-12.
# Generated by Medikit 0.8.0 on 2021-01-14.
# All changes will be overriden.
# Edit Projectfile and run “make update” (or “medikit update”) to regenerate.

Expand All @@ -24,7 +24,7 @@ VERSION ?= $(shell git describe 2>/dev/null || git rev-parse --short HEAD)
BLACK ?= $(shell which black || echo black)
BLACK_OPTIONS ?= --line-length 120 --exclude '/(\.git|\.hg|\.mypy_cache|\.tox|\.venv|\.release|_build|buck-out|build|dist|node_modules|{{cookiecutter.name}})/'
ISORT ?= $(PYTHON) -m isort
ISORT_OPTIONS ?= --recursive --apply -s node_modules
ISORT_OPTIONS ?= -s node_modules
PYTEST ?= $(PYTHON_DIRNAME)/pytest
PYTEST_OPTIONS ?= --capture=no --cov=$(PACKAGE) --cov-report html
VUEPRESS ?= $(shell which vuepress || echo vuepress)
Expand Down
22 changes: 18 additions & 4 deletions django_zero/commands/create.py
Expand Up @@ -32,22 +32,36 @@ def handle(self, *args, **options):
def handle_app(self, *args, **options):
check_dev_extras("django-zero create app")

name = options.pop("name")
path = "apps"
name = options.pop("name").replace(".", "/")
if name.startswith(path + "/"):
name = name[len(path) + 1 :]
package = path + "." + name.replace("/", ".")
app = package.split(".")[-1]

template = os.path.join(os.path.dirname(__file__), "templates/app")
from cookiecutter.main import cookiecutter

cookiecutter(template, checkout=False, output_dir=path, extra_context={"name": name, **options}, no_input=True)
try:
cookiecutter(
template,
checkout=False,
output_dir=path,
extra_context={"app": app, "name": name, "package": package, **options},
no_input=True,
)
except Exception as exc:
self.logger.exception(exc)
raise

print(
mondrian.humanizer.Success(
'Your "{}" application has been created.'.format(name),
'Your "{}" application has been created.'.format(package),
"Add the following to your `INSTALLED_APPS` in `config/settings.py`:",
"",
"INSTALLED_APPS += [",
" ...,",
" `'apps.{}',`".format(name),
" `'{}',`".format(package),
"]",
help_url=url_for_help("created/app.html"),
)
Expand Down
7 changes: 7 additions & 0 deletions django_zero/commands/lifecycle.py
Expand Up @@ -39,6 +39,7 @@ def add_arguments(self, parser):
parser.add_argument("--prod", "--production", "-p", action="store_true")
parser.add_argument("--bind", default=None)
parser.add_argument("--collectstatic", action="store_true")

dev_server = parser.add_mutually_exclusive_group(required=False)
dev_server.add_argument("--hot", action="store_true")
dev_server.add_argument("--hot-only", action="store_true")
Expand Down Expand Up @@ -66,6 +67,12 @@ def handle(self, *, bind=None, collectstatic=False, hot=False, hot_only=False, p
m = create_honcho_manager(mode="prod")
else:
check_installed()

if not bind:
host = os.environ.get('HOST', "127.0.0.1")
port = os.environ.get('PORT', "8000")
bind = host + ':' + port

m = create_honcho_manager(mode="dev", bind=bind, hot=hot, hot_only=hot_only, environ={"DJANGO_DEBUG": "1"})

m.loop()
Expand Down
2 changes: 2 additions & 0 deletions django_zero/commands/templates/app/cookiecutter.json
@@ -1,4 +1,6 @@
{
"name": "",
"app": "",
"package": "",
"_extensions": ["django_zero.commands.templates.DjangoZeroTemplatesExtension"]
}
@@ -1,5 +1,5 @@
from django.apps import AppConfig


class {{ cookiecutter.name | camelcase }}Config(AppConfig):
name = '{{ cookiecutter.name }}'
class {{ cookiecutter.app | camelcase }}Config(AppConfig):
name = '{{ cookiecutter.app }}'
@@ -0,0 +1 @@
import "./{{cookiecutter.app}}.scss";

This file was deleted.

@@ -1,5 +1,5 @@
from apps.{{cookiecutter.name}}.views import WelcomeView
from django.urls import path
from {{cookiecutter.package}}.views import WelcomeView

urlpatterns = [
path('', WelcomeView.as_view())
Expand Down
79 changes: 37 additions & 42 deletions setup.py
@@ -1,12 +1,11 @@
# Generated by Medikit 0.8.0 on 2021-01-12.
# Generated by Medikit 0.8.0 on 2021-01-14.
# All changes will be overriden.
# Edit Projectfile and run “make update” (or “medikit update”) to regenerate.

from setuptools import setup, find_packages
from codecs import open
from os import path

from setuptools import find_packages, setup

here = path.abspath(path.dirname(__file__))

# Py3 compatibility hacks, borrowed from IPython.
Expand All @@ -21,67 +20,63 @@ def execfile(fname, globs, locs=None):

# Get the long description from the README file
try:
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
except:
long_description = ""
long_description = ''

# Get the classifiers from the classifiers file
tolines = lambda c: list(filter(None, map(lambda s: s.strip(), c.split("\n"))))
tolines = lambda c: list(filter(None, map(lambda s: s.strip(), c.split('\n'))))
try:
with open(path.join(here, "classifiers.txt"), encoding="utf-8") as f:
with open(path.join(here, 'classifiers.txt'), encoding='utf-8') as f:
classifiers = tolines(f.read())
except:
classifiers = []

version_ns = {}
try:
execfile(path.join(here, "django_zero/_version.py"), version_ns)
execfile(path.join(here, 'django_zero/_version.py'), version_ns)
except EnvironmentError:
version = "dev"
version = 'dev'
else:
version = version_ns.get("__version__", "dev")
version = version_ns.get('__version__', 'dev')

setup(
author="Romain Dorgueil",
author_email="romain@dorgueil.net",
description="Zero-configuration django projects.",
license="Apache License, Version 2.0",
name="django_zero",
author='Romain Dorgueil',
author_email='romain@dorgueil.net',
description='Zero-configuration django projects.',
license='Apache License, Version 2.0',
name='django_zero',
version=version,
long_description=long_description,
classifiers=classifiers,
packages=find_packages(exclude=["ez_setup", "example", "test"]),
packages=find_packages(exclude=['ez_setup', 'example', 'test']),
include_package_data=True,
install_requires=[
"brotli ~= 1.0.9",
"django ~= 3.1, < 3.2",
"django-allauth ~= 0.44.0",
"django-includes ~= 0.3.1",
"jinja2 ~= 2.11",
"mondrian ~= 0.8",
"whitenoise ~= 5.2.0",
'brotli ~= 1.0.9', 'django ~= 3.1, < 3.2', 'django-allauth ~= 0.44.0',
'django-includes ~= 0.3.1', 'jinja2 ~= 2.11', 'mondrian ~= 0.8',
'whitenoise ~= 5.2.0'
],
extras_require={
"celery": ["celery ~= 5.0", "django_celery_beat ~= 2.1.0", "django_celery_results ~= 2.0.0"],
"channels": ["channels ~= 3.0.0", "daphne ~= 3.0.0"],
"dev": [
"cookiecutter ~= 1.7",
"coverage ~= 5.3",
"django-extensions ~= 3.1",
"django_debug_toolbar ~= 3.2",
"honcho ~= 1.0",
"isort",
"medikit ~= 0.7",
"pyquery ~= 1.4",
"pytest >= 5.4.0",
"pytest-cov ~= 2.7",
"pytest-django ~= 4.0",
"werkzeug ~= 1.0",
'celery': [
'celery ~= 5.0', 'django_celery_beat ~= 2.1.0',
'django_celery_results ~= 2.0.0'
],
'channels': ['channels ~= 3.0.0', 'daphne ~= 3.0.0'],
'dev': [
'cookiecutter ~= 1.7', 'coverage ~= 5.3',
'django-extensions ~= 3.1', 'django_debug_toolbar ~= 3.2',
'honcho ~= 1.0', 'isort', 'medikit ~= 0.7', 'pyquery ~= 1.4',
'pytest >= 5.4.0', 'pytest-cov ~= 2.7', 'pytest-django ~= 4.0',
'werkzeug ~= 1.0'
],
"prod": ["gunicorn ~= 20.0"],
'prod': ['gunicorn ~= 20.0']
},
entry_points={
'console_scripts': ['django-zero = django_zero.commands:main']
},
entry_points={"console_scripts": ["django-zero = django_zero.commands:main"]},
url="https://github.com/hartym/django-zero",
download_url="https://github.com/hartym/django-zero/archive/{version}.tar.gz".format(version=version),
url='https://github.com/hartym/django-zero',
download_url=
'https://github.com/hartym/django-zero/archive/{version}.tar.gz'.format(
version=version),
)

0 comments on commit 4b74b02

Please sign in to comment.