diff --git a/{{cookiecutter.app_name}}/requirements/prod.txt b/{{cookiecutter.app_name}}/requirements/prod.txt index c4719fa..2c27826 100644 --- a/{{cookiecutter.app_name}}/requirements/prod.txt +++ b/{{cookiecutter.app_name}}/requirements/prod.txt @@ -20,7 +20,6 @@ WTForms==2.0 # Deployment gunicorn>=17.5 -wsgiref>=0.1.2 # Assets Flask-Assets==0.10 diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/compat.py b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/compat.py new file mode 100644 index 0000000..863f2a0 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/compat.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +"""Python 2/3 compatibility module.""" + + +import sys + +PY2 = int(sys.version[0]) == 2 + +if PY2: + text_type = unicode + binary_type = str + string_types = (str, unicode) + unicode = unicode + basestring = basestring +else: + text_type = str + binary_type = bytes + string_types = (str,) + unicode = str + basestring = (str, bytes) diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py index 6dbff38..3120766 100644 --- a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py @@ -5,6 +5,7 @@ utilities. from sqlalchemy.orm import relationship from .extensions import db +from .compat import basestring # Alias common SQLAlchemy names Column = db.Column