HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //proc/self/root/home/arjun/projects/buyercall/buyercall/blueprints/__init__.py

def flask_environment(app=None):
    """ Get the current flask environment """
    if app:
        current_app = app
    else:
        from flask import current_app
        
    is_production = current_app.config.get('IS_PRODUCTION', False)
    server_name = current_app.config.get('SERVER_NAME', 'buyercall.com')

    if is_production:
        environment = 'prod'
    elif server_name:
        if 'demo' in server_name:
            environment = 'demo'
        else:
            environment = 'dev'    
    else:
        environment = 'dev'

    return environment