by moonboy
Internal tool (web app) with Google sign in and team management
import logging
from gunicorn.app.base import BaseApplication
from app_init import create_initialized_flask_app
# Flask app creation should be done by create_initialized_flask_app to avoid circular dependency problems.
app = create_initialized_flask_app()
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class StandaloneApplication(BaseApplication):
def __init__(self, app, options=None):
self.application = app
self.options = options or {}
super().__init__()
def load_config(self):
# Apply configuration to Gunicorn
for key, value in self.options.items():
if key in self.cfg.settings and value is not None:
self.cfg.set(key.lower(), value)
def load(self):
Frequently Asked Questions
What are some business applications for this Flask-based internal tool template?
This Flask-based internal tool template is versatile and can be applied to various business scenarios. Some potential applications include:
- Employee dashboards for HR management
- Sales team performance tracking tools
- Project management and task allocation systems
- Internal customer support ticketing systems
- Company-wide analytics and reporting platforms
The template's Google sign-in and team management features make it particularly suitable for organizations that want to restrict access to sensitive internal data while providing a user-friendly interface.
How does the team management feature benefit companies using this internal tool template?
The team management feature in this Flask-based internal tool template offers several benefits:
- Controlled access: Only authorized employees can access the tool
- Easy onboarding: New team members can be quickly added to the allow list
- Flexible permissions: Admins can manage access by individual email or domain
- Security: Unauthorized users are automatically rejected
- Scalability: As the company grows, the tool can accommodate more users without compromising security
These features ensure that sensitive company information remains protected while still being accessible to the right people.
Can you provide an example of how to add a new route to the Flask app in this template?
Certainly! To add a new route to the Flask app in this internal tool template, you would modify the routes.py
file. Here's an example of how to add a new route for a reports page:
python
@app.route("/reports")
def reports_route():
# Add any necessary logic here
return render_template("reports.html", title="Reports")
You would also need to create a corresponding reports.html
template in the templates
folder and update the navigation in _navigation.html
to include the new route.
How can businesses customize the look and feel of this Flask-based internal tool template?
Businesses can easily customize the look and feel of this internal tool template by:
- Modifying the CSS in
styles.css
to match company branding - Updating the logo by replacing
company_logo.png
in the static folder - Customizing the templates in the
templates
folder to add company-specific elements - Adjusting the color scheme in
custom-modal.css
for popups and modals - Modifying the
base.html
template to include additional scripts or stylesheets
These customizations allow businesses to create a cohesive brand experience across their internal tools.
How would you add a new model to the database in this Flask internal tool template?
To add a new model to the database in this Flask internal tool template, you would update the models.py
file. Here's an example of how to add a new Report
model:
```python class Report(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(120), nullable=False) content = db.Column(db.Text, nullable=False) created_at = db.Column(db.DateTime, default=datetime.utcnow) author_id = db.Column(db.Integer, db.ForeignKey('allow_list.id'), nullable=False)
author = db.relationship('AllowList', backref=db.backref('reports', lazy=True))
```
After adding the model, you would need to create a new migration file in the migrations
folder to add the corresponding table to the database. This ensures that the database schema stays in sync with your application models.
Created: | Last Updated:
Here's a step-by-step guide for using the Flask-based Internal Tool Template with Google Sign-In and Team Management:
Introduction
This template provides a reusable internal tool built with Flask, featuring Google Sign-In and team management capabilities. It's designed for creating internal applications where access is restricted to specific users or email domains.
Getting Started
To begin using this template:
- Click "Start with this Template" in the Lazy Builder interface.
Test the Application
After starting with the template:
- Click the "Test" button in the Lazy Builder interface.
- Wait for the application to deploy and start.
Using the Application
Once the application is running:
- You'll receive a URL for your deployed application through the Lazy CLI.
- Open this URL in your web browser.
Configuring Team Access
The application allows you to manage team access through the admin dashboard:
- Log in using your Google account.
- If you're the first user, you'll automatically be added as an admin.
- Navigate to the "Company Admins" page from the sidebar.
Managing Allowed Users
To add individual users:
- Click "Add New Admin" on the Company Admins page.
- Enter the user's email address.
- Click "Add Admin" to save.
Managing Allowed Domains
To allow entire email domains:
- Click "Add New Email Ending" on the Company Admins page.
- Enter the email domain (e.g., "example.com").
- Click "Allow Domain" to save.
Blocking Users
To block specific users:
- Find the user in the Company Admins list.
- Click the "Block" button next to their email.
Unblocking Users
To unblock users:
- Locate the blocked user in the Company Admins list.
- Click the "Unblock" button next to their email.
Customizing the Application
You can customize the application by modifying the following files:
templates/home.html
: Edit the content of the home page.templates/partials/_navigation.html
: Add or remove navigation items.routes.py
: Add new routes or modify existing ones.static/css/styles.css
: Customize the application's appearance.
Integrating with Other Services
This template is designed as a standalone internal tool. However, if you need to integrate it with other services, you can extend the routes.py
file to add new API endpoints or functionality as required.
Remember to thoroughly test any changes or integrations to ensure they work correctly within your organization's infrastructure.
Template Benefits
-
Rapid Internal Tool Development: This template provides a ready-to-use foundation for building internal web applications, significantly reducing development time and effort for creating company-specific tools.
-
Secure Access Control: With built-in Google Sign-In and team management features, the template ensures that only authorized personnel can access the internal tool, enhancing security and data protection.
-
Flexible User Management: The allow list, block list, and domain-based access features offer granular control over user access, making it easy to manage team members' permissions as the organization evolves.
-
Professional UI/UX: The template includes a polished, responsive design with a sidebar navigation and custom styling, providing a professional look and feel right out of the box.
-
Scalable Architecture: Built on Flask with SQLite database and Gunicorn server, the template offers a solid foundation that can be easily scaled and extended to accommodate growing business needs and additional features.