This guide will walk you through the process of setting up the Firebase database structure for the Face Attendance project on Mac, Windows, and Linux.
- Python 3.7 or higher installed on your system
- pip (Python package installer)
- Git (optional, for cloning the repository)
- A Google account
- Firebase project created
- Go to the Firebase Console (https://console.firebase.google.com/)
- Create a new project or select an existing one
- Enable Email/Password Authentication:
- In the left sidebar, click on "Authentication"
- Click on the "Sign-in method" tab
- Enable the "Email/Password" sign-in provider
- Set up Firestore:
- In the left sidebar, click on "Firestore Database"
- Click "Create database"
- Choose "Start in production mode" or "Start in test mode" based on your needs
- Select a location for your database
- Click "Enable"
If you're using Git:
git clone https://github.com/FaceOnLive/Face-Attendance-App-Flutter
cd Face-Attendance-App-Flutter
If not using Git, download the project files and navigate to the project directory.
- Create a virtual environment:
python3 -m venv face_attendance_env
- Activate the virtual environment:
source face_attendance_env/bin/activate
- Create a virtual environment:
python -m venv face_attendance_env
- Activate the virtual environment:
face_attendance_env\Scripts\activate
- Create a virtual environment:
python3 -m venv face_attendance_env
- Activate the virtual environment:
source face_attendance_env/bin/activate
With your virtual environment activated, run:
pip install firebase-admin
- In the Firebase Console, go to Project settings > Service Accounts
- Click "Generate new private key"
- Save the JSON file as
serviceAccountKey.json
in the project directory
With your virtual environment still activated:
python3 firebase_setup.py
python firebase_setup.py
- Go to the Firebase Console
- Navigate to Firestore Database
- Check if the collections "Users", "Members", and "Spaces" have been created with sample data
- If you get a "Module not found" error, ensure you've activated the virtual environment and installed the firebase-admin package.
- For Mac/Linux users: If you get a "python3: command not found" error, try using
python
instead ofpython3
. - If you encounter permission issues in Firestore, make sure you've set appropriate security rules in the Firebase Console.
- Keep your
serviceAccountKey.json
file secure and never commit it to a public repository. - In production, set up proper Firestore security rules to protect your data.
After successfully running the setup script, your Firebase Firestore database will be populated with sample data for the Face Attendance project. You can now proceed with connecting your Flutter application to this Firebase backend.
When you're done, deactivate the virtual environment:
deactivate
For any issues or questions, please refer to the project's documentation or contact the project maintainers.