Remove Python 2.7 support per

This commit is contained in:
Daniel Roy Greenfeld 2017-04-21 08:46:09 -07:00
parent 1ca507a5e0
commit 5944ced7a4
37 changed files with 6 additions and 107 deletions

View File

@ -128,7 +128,6 @@ Answer the prompts with your own desired options_. For example::
use_opbeat [n]: y
use_pycharm [n]: y
windows [n]: n
use_python3 [y]: y
use_docker [y]: n
use_heroku [n]: y
use_compressor [n]: y

View File

@ -14,7 +14,6 @@
"use_opbeat": "n",
"use_pycharm": "n",
"windows": "n",
"use_python3": "y",
"use_docker": "n",
"use_heroku": "n",
"use_elasticbeanstalk_experimental": "n",

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# cookiecutter-django documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
@ -10,8 +8,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
from __future__ import unicode_literals
from datetime import datetime
import os
import sys

View File

@ -54,10 +54,6 @@ use_pycharm [n]
windows [n]
Whether you'll be developing on Windows.
use_python3 [y]
By default, the Python code generated will be for Python 3.x. But if you
answer `n` here, it will be legacy Python 2.7 code.
use_docker [y]
Whether to use Docker_, separating the app and database into separate
containers.

View File

@ -12,7 +12,6 @@ A portion of this code was adopted from Django's standard crypto functions and
utilities, specifically:
https://github.com/django/django/blob/master/django/utils/crypto.py
"""
from __future__ import print_function
import os
import random
import shutil

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import re
import sh

View File

@ -8,8 +8,4 @@ before_install:
- sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm
language: python
python:
{% if cookiecutter.use_python3 == 'y' -%}
- "3.5"
{% else %}
- "2.7"
{%- endif %}

View File

@ -1,8 +1,4 @@
{% if cookiecutter.use_python3 == 'y' -%}
FROM python:3.5
{% else %}
FROM python:2.7
{%- endif %}
ENV PYTHONUNBUFFERED 1
# Requirements have to be pulled and installed here, otherwise caching won't work

View File

@ -1,8 +1,4 @@
{% if cookiecutter.use_python3 == 'y' -%}
FROM python:3.5
{% else %}
FROM python:2.7
{%- endif %}
ENV PYTHONUNBUFFERED 1
# Requirements have to be pulled and installed here, otherwise caching won't work

View File

@ -1 +0,0 @@
# -*- coding: utf-8 -*-

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Django settings for {{cookiecutter.project_name}} project.
@ -8,8 +7,6 @@ https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_literals
import environ
ROOT_DIR = environ.Path(__file__) - 3 # ({{ cookiecutter.project_slug }}/config/settings/base.py - 3 = {{ cookiecutter.project_slug }}/)

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Local settings

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Production Configurations
@ -12,10 +11,8 @@ Production Configurations
- Use opbeat for error reporting
{% endif %}
"""
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six
{% if cookiecutter.use_sentry_for_error_reporting == 'y' %}
import logging
{% endif %}
@ -109,9 +106,9 @@ AWS_EXPIRY = 60 * 60 * 24 * 7
# TODO See: https://github.com/jschneier/django-storages/issues/47
# Revert the following and use str after the above-mentioned bug is fixed in
# either django-storage-redux or boto
control = 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIRY, AWS_EXPIRY)
AWS_HEADERS = {
'Cache-Control': six.b('max-age=%d, s-maxage=%d, must-revalidate' % (
AWS_EXPIRY, AWS_EXPIRY))
'Cache-Control': bytes(control, encoding='latin-1')
}
# URL that handles the media served from MEDIA_ROOT, used for managing

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
'''
Test settings

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# {{ cookiecutter.project_name }} documentation build configuration file, created by
# sphinx-quickstart.
#
@ -11,8 +9,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
from __future__ import unicode_literals
import os
import sys

View File

@ -1,10 +1,9 @@
{% if cookiecutter.use_python3 == 'y' -%}
# Wheel 0.25+ needed to install certain packages on CPython 3.5+
# like Pillow and psycopg2
# See http://bitly.com/wheel-building-fails-CPython-35
# Verified bug on Python 3.5.1
wheel==0.29.0
{%- endif %}
# Bleeding edge Django
django==1.10.7 # pyup: >=1.10,<1.11

View File

@ -1 +1 @@
{% if cookiecutter.use_python3 == 'y' -%}python-3.5.3{% else %}python-2.7.10{%- endif %}
python-3.5.3

View File

@ -6,11 +6,7 @@ PROJECT_DIR="$(dirname "$WORK_DIR")"
pip --version >/dev/null 2>&1 || {
echo >&2 -e "\npip is required but it's not installed."
echo >&2 -e "You can install it by running the following command:\n"
{% if cookiecutter.use_python3 == 'y' -%}
echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python3 get-pip.py"
{% else %}
echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python2 get-pip.py"
{%- endif %}
echo >&2 -e "\n"
echo >&2 -e "\nFor more information, see pip documentation: https://pip.pypa.io/en/latest/"
exit 1;
@ -19,11 +15,7 @@ pip --version >/dev/null 2>&1 || {
virtualenv --version >/dev/null 2>&1 || {
echo >&2 -e "\nvirtualenv is required but it's not installed."
echo >&2 -e "You can install it by running the following command:\n"
{% if cookiecutter.use_python3 == 'y' -%}
echo >&2 "sudo -H pip3 install virtualenv"
{% else %}
echo >&2 "sudo -H pip2 install virtualenv"
{%- endif %}
echo >&2 -e "\n"
echo >&2 -e "\nFor more information, see virtualenv documentation: https://virtualenv.pypa.io/en/latest/"
exit 1;
@ -32,11 +24,7 @@ virtualenv --version >/dev/null 2>&1 || {
if [ -z "$VIRTUAL_ENV" ]; then
echo >&2 -e "\nYou need activate a virtualenv first"
echo >&2 -e 'If you do not have a virtualenv created, run the following command to create and automatically activate a new virtualenv named "venv" on current folder:\n'
{% if cookiecutter.use_python3 == 'y' -%}
echo >&2 -e "virtualenv venv --python=\`which python3\`"
{% else %}
echo >&2 -e "virtualenv venv --python=\`which python2\`"
{%- endif %}
echo >&2 -e "\nTo leave/disable the currently active virtualenv, run the following command:\n"
echo >&2 "deactivate"
echo >&2 -e "\nTo activate the virtualenv again, run the following command:\n"
@ -52,4 +40,3 @@ else
pip install -r $PROJECT_DIR/requirements.txt
{%- endif %}
fi

View File

@ -3,11 +3,7 @@
build-essential
#required to translate
gettext
{% if cookiecutter.use_python3 == 'y' -%}
python3-dev
{% else %}
python-dev
{%- endif %}
##shared dependencies of:
##Pillow, pylibmc

View File

@ -3,11 +3,7 @@
build-essential
#required to translate
gettext
{% if cookiecutter.use_python3 == 'y' -%}
python3-dev
{% else %}
python-dev
{%- endif %}
##shared dependencies of:
##Pillow, pylibmc
@ -25,4 +21,3 @@ libwebp-dev
##django-extensions
graphviz-dev

View File

@ -3,11 +3,7 @@
build-essential
#required to translate
gettext
{% if cookiecutter.use_python3 == 'y' -%}
python3-dev
{% else %}
python-dev
{%- endif %}
##shared dependencies of:
##Pillow, pylibmc
@ -25,4 +21,3 @@ libwebp-dev
##django-extensions
graphviz-dev

View File

@ -1,3 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '{{ cookiecutter.version }}'
__version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')])

View File

@ -3,4 +3,3 @@ To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-

View File

@ -3,4 +3,3 @@ To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.sites.models
from django.contrib.sites.models import _simple_domain_name_validator
from django.db import migrations, models

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.sites.models
from django.db import migrations, models

View File

@ -3,10 +3,6 @@ To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations

View File

@ -3,4 +3,3 @@ To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-

View File

@ -1,5 +1,4 @@
{% if cookiecutter.use_celery == 'y' %}
from __future__ import absolute_import
import os
from celery import Celery
from django.apps import apps, AppConfig
@ -31,7 +30,7 @@ class CeleryConfig(AppConfig):
{% if cookiecutter.use_pycharm == 'y' -%}
# Since raven is required in production only,
# imports might (most surely will) be wiped out
# during PyCharm code clean up started
# during PyCharm code clean up started
# in other environments.
# @formatter:off
{%- endif %}

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin

View File

@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-23 04:36
from __future__ import unicode_literals
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import url
from . import views

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView