From 352bb8da9a413847f6f4580b92e769d04fa5a48b Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Tue, 12 Dec 2017 20:23:43 +0100 Subject: [PATCH] dpaste isn't django 2.0 ready yet. --- dpaste/wsgi.py | 9 +-------- manage.py | 21 ++++++++++++++------- setup.py | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dpaste/wsgi.py b/dpaste/wsgi.py index b478327..9063591 100644 --- a/dpaste/wsgi.py +++ b/dpaste/wsgi.py @@ -8,14 +8,7 @@ https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os -# If a 'settings_local' file is present, use it -try: - from dpaste.settings import local - settings_module = "dpaste.settings.local" -except ImportError: - settings_module = "dpaste.settings" - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module) +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dpaste.settings.local") from django.core.wsgi import get_wsgi_application application = get_wsgi_application() diff --git a/manage.py b/manage.py index 74d1a10..cebf99f 100755 --- a/manage.py +++ b/manage.py @@ -3,13 +3,20 @@ import os import sys if __name__ == "__main__": - # If a 'settings_local' file is present, use it + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dpaste.settings.local") try: - from dpaste.settings import local - settings_module = "dpaste.settings.local" + from django.core.management import execute_from_command_line except ImportError: - settings_module = "dpaste.settings" - - os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module) - from django.core.management import execute_from_command_line + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise execute_from_command_line(sys.argv) diff --git a/setup.py b/setup.py index 0ff54af..973146d 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ setup( }, include_package_data=True, install_requires=[ - 'django>=1.8', + 'django>=1.8,<2.0', 'pygments>=1.6', 'django-markup>=1.0', ],