Skip to content

Instantly share code, notes, and snippets.

@fabiommendes
Created September 15, 2021 14:15
Show Gist options
  • Select an option

  • Save fabiommendes/248bf12f34d679fff108b0218ce96ae8 to your computer and use it in GitHub Desktop.

Select an option

Save fabiommendes/248bf12f34d679fff108b0218ce96ae8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment