예제 #1
0
import os
import motor.motor_asyncio as motor
from littlenv import littlenv

littlenv.load()


"""Global vars"""
API_VERSION = '1.0.1'  # TODO change after each change
TIMEZONE = os.getenv("TIMEZONE", None)

"""Database config"""
MONGO_NAME = os.getenv("MONGO_NAME", None)
MONGO_HOST = os.getenv("MONGO_HOST", None)
MONGO_PORT = os.getenv("MONGO_PORT", None)
MONGO_USERNAME = os.getenv("MONGO_USERNAME", None)
MONGO_PASSWORD = os.getenv("MONGO_PASSWORD", None)

# Config for DNS Seed List Connection Format
if '://' in MONGO_HOST:
    HOST_SUB = MONGO_HOST.split('://')[0]
    MONGO_HOST = MONGO_HOST.split('://')[1]
    MONGO_PORT = ''
else:
    HOST_SUB = 'mongodb'
    MONGO_PORT = ':' + MONGO_PORT

# Config user and pass mongo
if (MONGO_USERNAME is None or MONGO_USERNAME == '') and \
        (MONGO_PASSWORD is None or MONGO_PASSWORD == ''):
    AUTH = ""
예제 #2
0
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
from littlenv.littlenv import load

load()


def main():
    os.environ.setdefault('DJANGO_SETTINGS_MODULE',
                          os.environ.get('DJANGO_SETTINGS_MODULE'))
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?") from exc
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()