From 6453fea417de512a2219da5011e5896f61032d74 Mon Sep 17 00:00:00 2001 From: Audrey Roy Greenfeld Date: Thu, 13 Apr 2017 10:48:44 -0700 Subject: [PATCH] Easier placement of apps within the second level directory --- {{cookiecutter.project_slug}}/config/wsgi.py | 7 ++++++- {{cookiecutter.project_slug}}/manage.py | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/wsgi.py b/{{cookiecutter.project_slug}}/config/wsgi.py index 636f547a..05d56ab2 100644 --- a/{{cookiecutter.project_slug}}/config/wsgi.py +++ b/{{cookiecutter.project_slug}}/config/wsgi.py @@ -13,7 +13,12 @@ middleware here, or combine a Django application with an application of another framework. """ -import os +import os, sys + +# This allows easy placement of apps within the interior +# {{ cookiecutter.project_slug }} directory. +app_path = os.path.dirname(os.path.abspath(__file__)).replace('/config', '') +sys.path.append(os.path.join(app_path, '{{ cookiecutter.project_slug }}')) from django.core.wsgi import get_wsgi_application {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%} diff --git a/{{cookiecutter.project_slug}}/manage.py b/{{cookiecutter.project_slug}}/manage.py index 9de71376..9694c5f8 100755 --- a/{{cookiecutter.project_slug}}/manage.py +++ b/{{cookiecutter.project_slug}}/manage.py @@ -20,4 +20,10 @@ if __name__ == '__main__': "forget to activate a virtual environment?" ) raise + + # This allows easy placement of apps within the interior + # {{ cookiecutter.project_slug }} directory. + current_path = os.path.dirname(os.path.abspath(__file__)) + sys.path.append(os.path.join(current_path, '{{ cookiecutter.project_slug }}')) + execute_from_command_line(sys.argv)