This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from channels.auth import AuthMiddlewareStack | |
| from rest_framework.authtoken.models import Token | |
| from django.contrib.auth.models import AnonymousUser | |
| from django.db import close_old_connections | |
| class TokenAuthMiddleware: | |
| """ | |
| Token authorization middleware for Django Channels 2 | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| import os | |
| import requests | |
| from botocore.auth import SigV4Auth | |
| from requests_aws4auth import AWS4Auth | |
| from elasticsearch import RequestsHttpConnection | |
| class AWSRequestsHttpConnection(RequestsHttpConnection): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import functools | |
| from channels.handler import AsgiRequest | |
| from rest_framework.exceptions import AuthenticationFailed | |
| from rest_framework.settings import api_settings | |
| authenticators = [auth() for auth in api_settings.DEFAULT_AUTHENTICATION_CLASSES] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from flask import Flask, request, render_template, current_app | |
| from flask_wtf import Form | |
| from wtforms.validators import DataRequired | |
| from wtforms import SelectField, SelectMultipleField, SubmitField | |
| app = Flask(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| license: mit | |
| height: 600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This code is licensed under the terms of the MIT license | |
| * | |
| * Deep diff between two object, using lodash | |
| * @param {Object} object Object compared | |
| * @param {Object} base Object to compare with | |
| * @return {Object} Return a new object who represent the diff | |
| */ | |
| function difference(object, base) { | |
| function changes(object, base) { |
SQL to MongoDB Mapping Chart¶
In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.
Executables¶
The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from flask import Flask, render_template, request | |
| import stripe | |
| stripe_keys = { | |
| 'secret_key': os.environ['SECRET_KEY'], | |
| 'publishable_key': os.environ['PUBLISHABLE_KEY'] | |
| } | |
| stripe.api_key = stripe_keys['secret_key'] |
NewerOlder