Resolved conflict from changed base.html not having HTML IDs

This commit is contained in:
Colm O'Connor 2015-11-02 15:23:49 +08:00
commit acdec670f0
15 changed files with 177 additions and 84 deletions

View File

@ -2,6 +2,39 @@
All enhancements and patches to cookiecutter-django will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2015-10-28]
### Changed
- Update deployment-on-heroku.rst for ADMIN_URL (@yunti)
## [2015-10-27]
### Added
- Added sudo: true to the travis file (@MathijsHoogland)
## [2015-10-25]
### Added
- Move current logging config into production.py since it's not useful locally anyway. Used only if not using Sentry. (@audreyr)
- `setup.py` so we can list it on PyPI and therefore displayed on djangopackages.com as compatible with Python 3. (@pydanny)
- Versioning and tagging policy (@pydanny)
- Fixed flake8 issue (@pydanny)
## [2015-10-24]
### Changed
- Update nav in base template to latest Bootstrap 4 version (@audreyr)
- Replaced ADD with COPY in dockerfiles (@audreyr)
- Simplified development dockerfile (@jayfk)
- Moved the docker postgres volume on the development environment to it's own subfolder (@jayfk)
- Renamed DJANGO_CACHE_URL to REDIS_URL (@jayfk / proposed by @pydanny)
## [2015-10-22]
### Removed
- Remove unnecessary .gitkeep in static/images/ (@audreyr)
## [2015-10-21]
### Changed
- Updated requirements (@theskumar)
### Removed
- editorconfig comment that was just a isort settings link (@pydanny)
## [2015-10-19]
### Changed
- On Windows, don't install psycopg2 locally. Still install it in test/prod which are assumed to be Unix. (@audreyr)

View File

@ -29,6 +29,7 @@ You can either push the 'deploy' button in your generated README.rst or run thes
heroku config:set DJANGO_MAILGUN_API_KEY=YOUR_MAILGUN_API_KEY
heroku config:set PYTHONHASHSEED=random
heroku config:set DJANGO_ADMIN_URL=\^somelocation/
git push heroku master
heroku run python manage.py migrate

56
setup.py Normal file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env python
import os
import platform
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Our version ALWAYS matches the version of Django we support
# If Django has a new release, we branch, tag, then update this setting after the tag.
version = "1.8.5"
if sys.argv[-1] == 'tag':
os.system("git tag -a %s -m 'version %s'" % (version, version))
os.system("git push --tags")
sys.exit()
with open('README.rst') as readme_file:
long_description = readme_file.read()
setup(
name='cookiecutter-django',
version=version,
description='A Cookiecutter template for creating production-ready Django projects quickly.',
long_description=long_description,
author='Daniel Roy Greenfeld',
author_email='pydanny@gmail.com',
url='https://github.com/pydanny/cookiecutter-django',
packages=[],
license='BSD',
zip_safe=False,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Framework :: Django :: 1.8',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development',
],
keywords=(
'cookiecutter, Python, projects, project templates, django, '
'skeleton, scaffolding, project directory, setup.py'
),
)

View File

@ -13,7 +13,6 @@ indent_style = space
indent_size = 4
[*.py]
# https://github.com/timothycrosley/isort/wiki/isort-Settings
line_length=120
known_first_party={{ cookiecutter.repo_name }}
multi_line_output=3

View File

@ -1,3 +1,4 @@
sudo: true
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq build-essential gettext python-dev zlib1g-dev libpq-dev xvfb

View File

@ -6,16 +6,16 @@ FROM python:2.7
ENV PYTHONUNBUFFERED 1
# Requirements have to be pulled and installed here, otherwise caching won't work
ADD ./requirements /requirements
COPY ./requirements /requirements
RUN pip install -r /requirements/production.txt
RUN groupadd -r django && useradd -r -g django django
ADD . /app
COPY . /app
RUN chown -R django /app
ADD ./compose/django/gunicorn.sh /gunicorn.sh
ADD ./compose/django/entrypoint.sh /entrypoint.sh
COPY ./compose/django/gunicorn.sh /gunicorn.sh
COPY ./compose/django/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh && chown django /entrypoint.sh
RUN chmod +x /gunicorn.sh && chown django /gunicorn.sh

View File

@ -6,19 +6,11 @@ FROM python:2.7
ENV PYTHONUNBUFFERED 1
# Requirements have to be pulled and installed here, otherwise caching won't work
ADD ./requirements /requirements
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt
RUN groupadd -r django && useradd -r -g django django
ADD . /app
RUN chown -R django /app
ADD ./compose/django/gunicorn.sh /gunicorn.sh
ADD ./compose/django/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh && chown django /entrypoint.sh
RUN chmod +x /gunicorn.sh && chown django /gunicorn.sh
COPY ./compose/django/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
WORKDIR /app

View File

@ -4,7 +4,7 @@ set -e
# Since docker-compose relies heavily on environment variables itself for configuration, we'd have to define multiple
# environment variables just to support cookiecutter out of the box. That makes no sense, so this little entrypoint
# does all this for us.
export DJANGO_CACHE_URL=redis://redis:6379/0
export REDIS_URL=redis://redis:6379/0
# the official postgres image uses 'postgres' as default user if not set explictly.
if [ -z "$POSTGRES_ENV_POSTGRES_USER" ]; then
@ -13,6 +13,6 @@ fi
export DATABASE_URL=postgres://$POSTGRES_ENV_POSTGRES_USER:$POSTGRES_ENV_POSTGRES_PASSWORD@postgres:5432/$POSTGRES_ENV_POSTGRES_USER
{% if cookiecutter.use_celery == 'y' %}
export CELERY_BROKER_URL=$DJANGO_CACHE_URL
export CELERY_BROKER_URL=$REDIS_URL
{% endif %}
exec "$@"

View File

@ -220,55 +220,6 @@ LOGIN_URL = 'account_login'
# SLUGLIFIER
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
# LOGGING CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s '
'%(process)d %(thread)d %(message)s'
},
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True
},
'django.security.DisallowedHost': {
'level': 'ERROR',
'handlers': ['console', 'mail_admins'],
'propagate': True
}
}
}
{% if cookiecutter.use_celery == "y" %}
########## CELERY
INSTALLED_APPS += ('{{cookiecutter.repo_name}}.taskapp.celery.CeleryConfig',)

View File

@ -216,6 +216,54 @@ RAVEN_CONFIG = {
'CELERY_LOGLEVEL': env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO),
'DSN': SENTRY_DSN
}
{% elif cookiecutter.use_sentry == "n" %}
# LOGGING CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s '
'%(process)d %(thread)d %(message)s'
},
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True
},
'django.security.DisallowedHost': {
'level': 'ERROR',
'handlers': ['console', 'mail_admins'],
'propagate': True
}
}
}
{% endif %}
# Custom Admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %}
ADMIN_URL = env('DJANGO_ADMIN_URL')

View File

@ -3,7 +3,7 @@ postgres:
volumes:
# If you are using boot2docker, postgres data has to live in the VM for now until #581 is fixed
# for more info see here: https://github.com/boot2docker/boot2docker/issues/581
- /data/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data
- /data/dev/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data
django:
dockerfile: Dockerfile-dev

View File

@ -34,7 +34,7 @@ psycopg2==2.6.1
# Unicode slugification
unicode-slugify==0.1.3
django-autoslug==1.9.2
django-autoslug==1.9.3
# Time zones support
pytz==2015.6

View File

@ -1,11 +1,11 @@
# Local development dependencies go here
-r base.txt
coverage==4.0
coverage==4.0.1
Sphinx
django-extensions==1.5.7
Werkzeug==0.10.4
django-test-plus==1.0.9
factory_boy==2.5.2
factory_boy==2.6.0
# django-debug-toolbar that works with Django 1.5+
django-debug-toolbar==1.4

View File

@ -30,31 +30,43 @@
</head>
<body>
<div class="m-b">
<nav class="navbar navbar-dark navbar-static-top bg-inverse">
<div class="container">
<a class="navbar-brand" href="/">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a>
<a class="navbar-brand" href="/">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a>
<button type="button" class="navbar-toggler hidden-sm-up pull-right" data-toggle="collapse" data-target="#bs-navbar-collapse-1">
&#9776;
</button>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-toggleable-xs" id="bs-navbar-collapse-1">
<nav class="nav navbar-nav">
<a class="nav-link nav-item" href="{% url 'home' %}">Home</a>
<a class="nav-link nav-item" href="{% url 'about' %}">About</a>
</nav>
<nav class="nav navbar-nav pull-right">
<ul class="nav navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{% url 'home' %}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'about' %}">About</a>
</li>
</ul>
<ul class="nav navbar-nav pull-right">
{% if request.user.is_authenticated %}
<a class="nav-link nav-item" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
<a class="nav-link nav-item" href="{% url 'account_logout' %}">{% trans "Logout" %}</a>
<li class="nav-item">
<a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'account_logout' %}">{% trans "Logout" %}</a>
</li>
{% else %}
<a id="sign-up-link" class="nav-link nav-item" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
<a id="log-in-link" class="nav-link nav-item" href="{% url 'account_login' %}">{% trans "Log In" %}</a>
<li class="nav-item">
<a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
</li>
<li class="nav-item">
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% trans "Log In" %}</a>
</li>
{% endif %}
</nav>
</ul>
</div>
</div>
</nav>