How to use the masonite.env function in masonite

To help you get started, we’ve selected a few masonite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MasoniteFramework / masonite / tests / core / test_managers_mail_manager.py View on Github external
def test_send_mail_sends(self):
        if env('RUN_MAIL'):
            self.app.bind('MailSmtpDriver', MailDriver)

            self.assertTrue(MailManager(self.app).driver('smtp').to('idmann509@gmail.com').send('hi'))
github MasoniteFramework / masonite / config / mail.py View on Github external
"""Mail Driver
The default driver you will like to use for sending emails. You may add
additional drivers as you need or pip install additional drivers.

Supported: 'smtp', 'mailgun'
"""

DRIVER = env('MAIL_DRIVER', 'smtp')

"""Mail Drivers
Different drivers you can use for sending email.
"""

DRIVERS = {
    'smtp': {
        'host': env('MAIL_HOST', 'smtp.mailtrap.io'),
        'port': env('MAIL_PORT', '465'),
        'username': env('MAIL_USERNAME', 'username'),
        'password': env('MAIL_PASSWORD', 'password'),
    },
    'mailgun': {
        'secret': env('MAILGUN_SECRET', 'key-XX'),
        'domain': env('MAILGUN_DOMAIN', 'sandboxXX.mailgun.org')
    }
github MasoniteFramework / masonite / config / database.py View on Github external
'driver': 'mysql',
        'host': env('DB_HOST'),
        'database': env('DB_DATABASE'),
        'port': env('DB_PORT'),
        'user': env('DB_USERNAME'),
        'password': env('DB_PASSWORD'),
        'log_queries': env('DB_LOG'),
    },
    'postgres': {
        'driver': 'postgres',
        'host': env('DB_HOST'),
        'database': env('DB_DATABASE'),
        'port': env('DB_PORT'),
        'user': env('DB_USERNAME'),
        'password': env('DB_PASSWORD'),
        'log_queries': env('DB_LOG'),
    },
}

DB = DatabaseManager(DATABASES)
Model.set_connection_resolver(DB)


logger = logging.getLogger('orator.connection.queries')
logger.setLevel(logging.DEBUG)

formatter = logging.Formatter(
    'It took %(elapsed_time)sms to execute the query %(query)s'
)

handler = logging.StreamHandler()
handler.setFormatter(formatter)
github the-benchmarker / web-frameworks / python / masonite / config / storage.py View on Github external
DRIVER = env("STORAGE_DRIVER", "disk")

"""Storage Drivers
Different drivers you can use for storing file uploads.
"""

DRIVERS = {
    "disk": {"location": "storage/uploads"},
    "s3": {
        "client": env("S3_CLIENT", "AxJz..."),
        "secret": env("S3_SECRET", "HkZj..."),
        "bucket": env("S3_BUCKET", "s3bucket"),
    },
    "rackspace": {
        "username": env("RACKSPACE_USERNAME", "username"),
        "secret": env("RACKSPACE_SECRET", "3cd5b0e8..."),
        "container": env("RACKSPACE_CONTAINER", "masonite"),
        "region": env("RACKSPACE_REGION", "IAD"),
        "location": "http://03c8...rackcdn.com/",
    },
    "azure": {
        "name": env("AZURE_NAME", "masonite"),
        "secret": env("AZURE_SECRET", "RykG8qsa4kTOddF=="),
        "connection": env(
            "AZURE_CONNECTION", "DefaultEndpointsProtocol=https;AccountName=..."
        ),
        "container": env("AZURE_CONTAINER", "masonite"),
        "location": "https://masonite.blob.core.windows.net/container/",
    },
}
github MasoniteFramework / masonite / config / queue.py View on Github external
"""Queue Drivers
Put any configuration settings for your drivers in this configuration setting.
"""

DRIVERS = {
    'async': {
        'mode': 'threading'
    },
    'amqp': {
        'username': env('QUEUE_USERNAME', 'guest'),
        'vhost': env('QUEUE_VHOST', ''),
        'password': env('QUEUE_PASSWORD', 'guest'),
        'host': env('QUEUE_HOST', 'localhost'),
        'port': env('QUEUE_PORT', '5672'),
        'channel': env('QUEUE_CHANNEL', 'default'),
    }
github MasoniteFramework / masonite / config / application.py View on Github external
"""Application Debug Mode
When your application is in debug mode, detailed error messages with
stack traces will be shown on every error that occurs within your
application. If disabled, a simple generic error page is shown
"""

DEBUG = env('APP_DEBUG', False)

"""Secret Key
This key is used to encrypt and decrypt various values. Out of the box
Masonite uses this key to encrypt or decrypt cookies so you can use
it to encrypt and decrypt various values using the Masonite Sign
class. Read the documentation on Encryption to find out how.
"""

KEY = env('KEY', None)

"""Application URL
Sets the root URL of the application. This is primarily used for testing
"""

URL = 'http://localhost:8000'

"""Base Directory
Sets the root path of your project
"""

BASE_DIRECTORY = os.getcwd()

"""Static Root
Set the static root of your application that you wil use to store assets
"""
github MasoniteFramework / masonite / config / storage.py View on Github external
},
    'rackspace': {
        'username': env('RACKSPACE_USERNAME', 'username'),
        'secret': env('RACKSPACE_SECRET', '3cd5b0e8...'),
        'container': env('RACKSPACE_CONTAINER', 'masonite'),
        'region': env('RACKSPACE_REGION', 'IAD'),
        'location': 'http://03c8...rackcdn.com/'
    },
    'azure': {
        'name': env('AZURE_NAME', 'masonite'),
        'secret': env('AZURE_SECRET', 'RykG8qsa4kTOddF=='),
        'connection': env(
            'AZURE_CONNECTION',
            'DefaultEndpointsProtocol=https;AccountName=...'
        ),
        'container': env('AZURE_CONTAINER', 'masonite'),
        'location': 'https://masonite.blob.core.windows.net/container/'
    },
}


"""Static Files
Put anywhere you keep your static assets in a key, value dictionary here
The key will be the folder you put your assets in relative to the root
and the value will be the alias you wish to have in your templates.
You may have multiple aliases of the same name

Example will be the static assets folder at /storage/static
and an alias of <img src="/static/image.png">
"""

STATICFILES = {
github MasoniteFramework / masonite / config / storage.py View on Github external
"""Storage Settings."""

from masonite import env

"""Storage Driver
The default driver you will like to use for storing uploads. You may add
additional drivers as you need or pip install additional drivers.

Supported: 'disk', 's3', 'rackspace', 'googlecloud', 'azure'
"""

DRIVER = env('STORAGE_DRIVER', 'disk')

"""Storage Drivers
Different drivers you can use for storing file uploads.
"""

DRIVERS = {
    'disk': {
        'location': {
            'uploading': 'uploads/'
        }
    },
    's3': {
        'client': env('S3_CLIENT', 'AxJz...'),
        'secret': env('S3_SECRET', 'HkZj...'),
        'bucket': env('S3_BUCKET', 's3bucket'),
        'location': 'http://s3.amazon.com/bucket',
github MasoniteFramework / masonite / config / mail.py View on Github external
your application.
"""

FROM = {
    'address': env('MAIL_FROM_ADDRESS', 'hello@example.com'),
    'name': env('MAIL_FROM_NAME', 'Masonite')
}

"""Mail Driver
The default driver you will like to use for sending emails. You may add
additional drivers as you need or pip install additional drivers.

Supported: 'smtp', 'mailgun'
"""

DRIVER = env('MAIL_DRIVER', 'smtp')

"""Mail Drivers
Different drivers you can use for sending email.
"""

DRIVERS = {
    'smtp': {
        'host': env('MAIL_HOST', 'smtp.mailtrap.io'),
        'port': env('MAIL_PORT', '465'),
        'username': env('MAIL_USERNAME', 'username'),
        'password': env('MAIL_PASSWORD', 'password'),
    },
    'mailgun': {
        'secret': env('MAILGUN_SECRET', 'key-XX'),
        'domain': env('MAILGUN_DOMAIN', 'sandboxXX.mailgun.org')
    }
github MasoniteFramework / masonite / config / database.py View on Github external
Supported Drivers: 'sqlite', 'mysql', 'postgres'
"""

DATABASES = {
    'default': env('DB_CONNECTION', 'sqlite'),
    'sqlite': {
        'driver': 'sqlite',
        'database': env('SQLITE_DB_DATABASE', 'masonite.db'),
        'log_queries': env('DB_LOG'),
        'prefix': ''
    },
    'mysql': {
        'driver': 'mysql',
        'host': env('DB_HOST'),
        'database': env('DB_DATABASE'),
        'port': env('DB_PORT'),
        'user': env('DB_USERNAME'),
        'password': env('DB_PASSWORD'),
        'log_queries': env('DB_LOG'),
    },
    'postgres': {
        'driver': 'postgres',
        'host': env('DB_HOST'),
        'database': env('DB_DATABASE'),
        'port': env('DB_PORT'),
        'user': env('DB_USERNAME'),
        'password': env('DB_PASSWORD'),
        'log_queries': env('DB_LOG'),
    },
}