Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add manage.py to project template. #30

Open
wants to merge 1 commit into
base: tai
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ixc_django_docker/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import environs
import os

from django.core.exceptions import ImproperlyConfigured
Expand All @@ -13,7 +14,13 @@ def _(module, from_dir):


# Get project directory from environment. This MUST already be defined.
PROJECT_DIR = os.environ['PROJECT_DIR']
PROJECT_DIR = env('PROJECT_DIR')

# Load `.env` file into `os.environ`.
env = environs.Env()
env.read_env(
os.path.join(PROJECT_DIR, '.env'), override=env('ENVIRONS_OVERRIDE', False)
)

# Base settings.
BASE_SETTINGS = os.environ.get(
Expand Down
25 changes: 25 additions & 0 deletions project_template/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys

# Define required `ixc-django-docker` env var.
os.environ['PROJECT_DIR'] = os.path.abspath(os.path.dirname(__file__))


def main():
"""Run administrative tasks."""
os.environ.setdefault('ixc_django_docker.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()