mirror of
https://github.com/kjanat/livegraphs-django.git
synced 2026-02-13 10:29:30 +01:00
- build(pre-commit): upgrade hooks (django-upgrade 1.29.1, uv 0.9.7, ruff 0.14.3, bandit 1.8.6) - build(pre-commit): add uv-lock hook, tombi TOML formatter, prettier-plugin-packagejson - build(pre-commit): disable Django check hooks (commented out) - build(pre-commit): switch npx → bunx for prettier execution - build(node): add bun.lock, update prettier config with schema + packagejson plugin - style: apply ruff format to all Python files (comments, spacing, imports) - style: apply prettier format to all JS/CSS files (comment styles, spacing) - style: apply tombi format to pyproject.toml (reordered sections, consistent formatting) - chore: remove emoji from bash script comments for consistency BREAKING CHANGE: Django check and migration check hooks disabled in pre-commit config
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
# !/usr/bin/env python
|
|
"""
|
|
Entry point for Django commands executed as Python modules.
|
|
This enables commands like `python -m runserver`.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def main():
|
|
"""Determine the command to run and execute it."""
|
|
# Get the command name from the entry point
|
|
cmd_name = Path(sys.argv[0]).stem
|
|
|
|
# Default to 'manage.py' if no specific command
|
|
if cmd_name == "__main__":
|
|
# When running as `python -m dashboard_project`, just pass control to manage.py
|
|
from dashboard_project.manage import main as manage_main
|
|
|
|
manage_main()
|
|
return
|
|
|
|
# Add current directory to path if needed
|
|
cwd = str(Path.cwd())
|
|
if cwd not in sys.path:
|
|
sys.path.insert(0, cwd)
|
|
|
|
# Set Django settings module
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dashboard_project.settings")
|
|
|
|
# For specific commands, insert the command name at the start of argv
|
|
if cmd_name in [
|
|
"runserver",
|
|
"migrate",
|
|
"makemigrations",
|
|
"collectstatic",
|
|
"createsuperuser",
|
|
"shell",
|
|
"test",
|
|
]:
|
|
sys.argv.insert(1, cmd_name)
|
|
|
|
# Execute the Django management command
|
|
from django.core.management import execute_from_command_line
|
|
|
|
execute_from_command_line(sys.argv)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|