Easier placement of apps within the second level directory

This commit is contained in:
Audrey Roy Greenfeld 2017-04-13 10:48:44 -07:00 committed by Daniel Roy Greenfeld
parent 667d4df01d
commit 6453fea417
2 changed files with 12 additions and 1 deletions

View File

@ -13,7 +13,12 @@ middleware here, or combine a Django application with an application of another
framework. 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 from django.core.wsgi import get_wsgi_application
{% if cookiecutter.use_sentry_for_error_reporting == 'y' -%} {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}

View File

@ -20,4 +20,10 @@ if __name__ == '__main__':
"forget to activate a virtual environment?" "forget to activate a virtual environment?"
) )
raise 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) execute_from_command_line(sys.argv)