Fixed deploy command.

see #1024
This commit is contained in:
Antoine Nguyen
2017-02-10 15:39:37 +01:00
parent 21aacab526
commit 3297b88d4f
3 changed files with 14 additions and 9 deletions
+1
View File
@@ -1,3 +1,4 @@
# pylint: disable=invalid-name, protected-access
"""Admin urls."""
from django.conf.urls import url
+13 -8
View File
@@ -9,8 +9,7 @@ from django.template import Context, Template
class Command(object):
"""Base command class
"""Base command class.
A valid administrative command must inherit from this class.
"""
@@ -22,7 +21,12 @@ class Command(object):
self._parser = argparse.ArgumentParser()
self._verbose = verbose
if not settings.configured:
settings.configure()
settings.configure(
TEMPLATES=[{
"BACKEND": (
"django.template.backends.django.DjangoTemplates")
}]
)
self._templates_dir = "%s/templates" % os.path.dirname(__file__)
def _render_template(self, tplfile, env):
@@ -52,18 +56,19 @@ def scan_for_commands(dirname=""):
path = os.path.join(os.path.dirname(__file__), dirname)
result = {}
for f in os.listdir(path):
if f in ['.', '..', '__init__.py']:
if f in [".", "..", "__init__.py"]:
continue
if not f.endswith('.py'):
if not f.endswith(".py"):
continue
if os.path.isfile(f):
continue
cmdname = f.replace('.py', '')
cmdname = f.replace(".py", "")
cmdmod = __import__("modoboa.core.commands", globals(), locals(),
[cmdname])
cmdmod = getattr(cmdmod, cmdname)
if '_' in cmdname:
cmdclassname = ''.join([s.capitalize() for s in cmdname.split('_')])
if "_" in cmdname:
cmdclassname = "".join(
[s.capitalize() for s in cmdname.split("_")])
else:
cmdclassname = cmdname.capitalize()
try:
-1
View File
@@ -17,7 +17,6 @@ except ImportError:
import django
from django.core import management
from django.template import Context, Template
import dj_database_url
from modoboa.core.commands import Command