import os
import sys

def create_app(app_name):
    os.makedirs(f"{app_name}/models", exist_ok=True)
    os.makedirs(f"{app_name}/views", exist_ok=True)

    with open(f"{app_name}/models/__init__.py", "w") as f:
        f.write("# models here\n")

    with open(f"{app_name}/views/__init__.py", "w") as f:
        f.write("# views here\n")

    with open(f"{app_name}/urls.py", "w") as f:
        f.write("from django.urls import path\n\nurlpatterns = []\n")

    with open(f"{app_name}/__init__.py", "w") as f:
        pass

    print(f"App Django '{app_name}' créée avec succès !")

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: django-create-app <nom_app>")
    else:
        create_app(sys.argv[1])
