Spaces:
Runtime error
Runtime error
Download tests/init_db.py from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 466 Bytes
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/init_db.py
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/tests/init_db.py
-
curl -L -o init_db.py https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/init_db.py
466 Bytes
| import os | |
| from main import app, db | |
| from utils.db.db import Admin, Doctor, Patient, AdministrativeAssistant | |
| with app.app_context(): | |
| # create the database and the db table | |
| db.create_all() | |
| # create a default admin user if one doesn't exist | |
| if not Admin.query.filter_by(username='admin').first(): | |
| admin = Admin(username='admin', password='password') | |
| db.session.add(admin) | |
| db.session.commit() | |
| print("Database initialized.") | |