Skip to content

Commit

Permalink
Minor fix in setup.py. Better error handling for incorrect path when …
Browse files Browse the repository at this point in the history
…using esdocs-django.
  • Loading branch information
jaddison committed Sep 16, 2018
1 parent c8720c4 commit 86f8ac7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion esdocs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import logging

__appname__ = __package__
__version__ = "0.1"
__version__ = "0.1.1"

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

Expand Down
14 changes: 11 additions & 3 deletions esdocs/contrib/esdjango/run.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import logging

import django
from django.db import connections

from ...controller import Controller
from ...utils import run as base_run

logger = logging.getLogger(__name__)


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

# Note: the serializers and compatibility hooks are already initialized
# in esdocs.contrib.esdjango.apps
django.setup()
try:
# Note: the serializers and compatibility hooks are already initialized
# in esdocs.contrib.esdjango.apps
django.setup()
except ImportError:
print("esdocs-django must be run from the root of your Django project (where manage.py lives).")
return

base_run(DjangoController)

Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
Expand All @@ -44,11 +45,11 @@
packages=find_packages(),
py_modules=['esdocs'],

python_requires='>=3.5',
python_requires='>=3.4',
install_requires=[
'elasticsearch-dsl>6.2.1'
],
extras_requires={
extras_require={
'gevent': ['gevent', 'gipc']
},

Expand Down

0 comments on commit 86f8ac7

Please sign in to comment.