Skip to content

Commit 86f8ac7

Browse files
committed
Minor fix in setup.py. Better error handling for incorrect path when using esdocs-django.
1 parent c8720c4 commit 86f8ac7

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

esdocs/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import logging
2727

2828
__appname__ = __package__
29-
__version__ = "0.1"
29+
__version__ = "0.1.1"
3030

3131
app_version = "{}/{}".format(__appname__, __version__)
3232

esdocs/contrib/esdjango/run.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import logging
2+
13
import django
24
from django.db import connections
35

46
from ...controller import Controller
57
from ...utils import run as base_run
68

9+
logger = logging.getLogger(__name__)
10+
711

812
class DjangoController(Controller):
913
def parallel_prep(self):
@@ -25,9 +29,13 @@ def run():
2529
# command will be run from the same dir a Django project's manage.py).
2630
sys.path.append(os.getcwd())
2731

28-
# Note: the serializers and compatibility hooks are already initialized
29-
# in esdocs.contrib.esdjango.apps
30-
django.setup()
32+
try:
33+
# Note: the serializers and compatibility hooks are already initialized
34+
# in esdocs.contrib.esdjango.apps
35+
django.setup()
36+
except ImportError:
37+
print("esdocs-django must be run from the root of your Django project (where manage.py lives).")
38+
return
3139

3240
base_run(DjangoController)
3341

setup.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
'Programming Language :: Python',
3434
'Programming Language :: Python :: 3 :: Only',
3535
'Programming Language :: Python :: 3',
36+
'Programming Language :: Python :: 3.4',
3637
'Programming Language :: Python :: 3.5',
3738
'Programming Language :: Python :: 3.6',
3839
'Programming Language :: Python :: 3.7',
@@ -44,11 +45,11 @@
4445
packages=find_packages(),
4546
py_modules=['esdocs'],
4647

47-
python_requires='>=3.5',
48+
python_requires='>=3.4',
4849
install_requires=[
4950
'elasticsearch-dsl>6.2.1'
5051
],
51-
extras_requires={
52+
extras_require={
5253
'gevent': ['gevent', 'gipc']
5354
},
5455

0 commit comments

Comments
 (0)