Commit 0e066313 by Usman Khalid

Added django.setup() to scripts/render_templates.py and sphinx conf.py

parent 5675f9d5
...@@ -43,6 +43,9 @@ sys.path.append(root / "openassessment/xblock") ...@@ -43,6 +43,9 @@ sys.path.append(root / "openassessment/xblock")
sys.path.append(root / "openassessment/templates") sys.path.append(root / "openassessment/templates")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.base") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.base")
import django
django.setup()
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
......
...@@ -32,6 +32,7 @@ import pytz ...@@ -32,6 +32,7 @@ import pytz
# This is a bit of a hack to ensure that the root repo directory # This is a bit of a hack to ensure that the root repo directory
# is in the Python path, so Django can find the settings module. # is in the Python path, so Django can find the settings module.
sys.path.append(os.path.dirname(os.path.dirname(__file__))) sys.path.append(os.path.dirname(os.path.dirname(__file__)))
import django
from django.template.context import Context from django.template.context import Context
from django.template.loader import get_template from django.template.loader import get_template
...@@ -41,6 +42,8 @@ USAGE = u"{prog} TEMPLATE_DESC" ...@@ -41,6 +42,8 @@ USAGE = u"{prog} TEMPLATE_DESC"
DATETIME_REGEX = re.compile("^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$") DATETIME_REGEX = re.compile("^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$")
django.setup()
def parse_dates(context): def parse_dates(context):
""" """
Transform datetime strings into Python datetime objects. Transform datetime strings into Python datetime objects.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment