ArchiveBox/archivebox/manage.py

30 lines
1.4 KiB
Python
Raw Normal View History

2019-04-02 20:36:41 +00:00
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
# if you're a developer working on archivebox, still prefer the archivebox
# versions of ./manage.py commands whenever possible. When that's not possible
# (e.g. makemigrations), you can comment out this check temporarily
2024-05-06 13:58:03 +00:00
if not ('makemigrations' in sys.argv or 'migrate' in sys.argv or 'startapp' in sys.argv):
2020-12-06 00:11:36 +00:00
print("[X] Don't run ./manage.py directly (unless you are a developer running makemigrations):")
2020-06-25 21:47:55 +00:00
print()
2020-12-06 00:11:36 +00:00
print(' Hint: Use these archivebox CLI commands instead of the ./manage.py equivalents:')
2020-06-25 21:47:55 +00:00
print(' archivebox init (migrates the databse to latest version)')
print(' archivebox server (runs the Django web server)')
print(' archivebox shell (opens an iPython Django shell with all models imported)')
print(' archivebox manage [cmd] (any other management commands)')
raise SystemExit(2)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
2019-04-02 20:36:41 +00:00
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)