Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'))
"""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')
}
'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)
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/",
},
}
"""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'),
}
"""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
"""
},
'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 = {
"""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',
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')
}
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'),
},
}