Download create_superadmin.py from OpenVar/backend: direct link, hf CLI and curl.
- Browser
- Download file 652 Bytes
-
https://huggingface.co/spaces/OpenVar/backend/resolve/af567cf2d3151dc4af63f8fca965fd0f96d345df/create_superadmin.py
- Command line
-
hf download hf://spaces/OpenVar/backend@af567cf2d3151dc4af63f8fca965fd0f96d345df/create_superadmin.py
-
curl -L -o create_superadmin.py https://huggingface.co/spaces/OpenVar/backend/resolve/af567cf2d3151dc4af63f8fca965fd0f96d345df/create_superadmin.py
652 Bytes
| from app.database import SessionLocal | |
| from app.models.db import User, UserType | |
| from app.services.auth_service import hash_password | |
| def setup(): | |
| db = SessionLocal() | |
| existing = db.query(User).filter(User.email == "admin@openvar.io").first() | |
| if not existing: | |
| su = User( | |
| email="admin@openvar.io", | |
| hashed_password=hash_password("admin"), | |
| full_name="OpenVar Admin", | |
| user_type=UserType.enterprise, | |
| is_superadmin=True, | |
| ) | |
| db.add(su) | |
| db.commit() | |
| print("Admin created") | |
| else: | |
| print("Admin exists") | |
| if __name__ == "__main__": | |
| setup() | |