Fixed #30003 -- Added usable entry point in default manage.py.

This commit is contained in:
jpic 2018-12-06 20:45:40 +01:00 committed by Tim Graham
parent 4c7c608a1d
commit 9453bc77f4
1 changed files with 6 additions and 1 deletions

View File

@ -2,7 +2,8 @@
import os import os
import sys import sys
if __name__ == '__main__':
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
@ -13,3 +14,7 @@ if __name__ == '__main__':
"forget to activate a virtual environment?" "forget to activate a virtual environment?"
) from exc ) from exc
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()