Saravanan666/pypi-org huggingface dataset:
Package: djmailer
Django Mailersend (Djmailer)DjmailerContentRequirementsInstallationTestingLicenseRequirementsPython 3.8+The package has 2 required dependencies:Django>=3.Mailersend.InstallationThis project uses celery to send emails, so you need to set up celery for your project first.If you have already configured celery and a broker for it, it will be enough to run the following command to install:pipinstalldjmailerIf you are going to install and configure celery to use redis run the following command:pipinstalldjmailer[redis]Then add 'djmailer' to your INSTALLED_APPS.INSTALLED_APPS=[...'djmailer',]Django projectsettings.pyfile might include following constants:# djmailer settingsEMAIL_BACKEND='djmailer.backend.EmailBackend'DJMAILER_FROM_EMAIL='verified@mail.com'DJMAILER_FROM_NAME='Verified Name'MAILERSEND_API_KEY='YOUR_MAILERSEND_API_KEY'In order for celery to be able to detect tasks in django-mailsend, you need to add package to the task detection function in the configuration file (usually celery.py)....app.autodiscover_tasks(packages=['djmailer',])Also in therepositoryon GitHub there is an example of a Django project on which everything is already configured.TestingTo run tests in your project environment just run following command:pythonmanage.pytestdjmailerToxis used to test this package.For run tests with python 3.8, 3.9, 3.10 and 3.11 must be installedYou can usepyenvfor dynamic managing python versionsTo run tests, install and run tox with the following commands:# install toxpipinstalltox# run toxtoxLicenseThis project is licensed under the MIT License. See theLICENSEfile for details.
Package: djmailgun
Package for sending emails via mailgun. (This package based ondjango-mailgunpackage)Currently tested only on Python 3Overviewdjmailgun is a drop-in mail backend for Django, perhttps://docs.djangoproject.com/en/1.8/topics/email/#email-backendsInstallationInstall django-mailgun:pip install django-mailgunConfigurationDepends on version you would like to use:1) EMAIL_BACKEND = 'djmailgun.backends.v1.Backend'
2) EMAIL_BACKEND = 'djmailgun.backends.v2.Backend'
3) EMAIL_BACKEND = 'djmailgun.backends.v3.Backend'Next you have to setup access key and server name and there are two ways
of doing this.You could just add this in settings fileMAILGUN_ACCESS_KEY  = 'ACCESS-KEY'
MAILGUN_SERVER_NAME = 'SERVER-NAME'You could migrate all package migrations via./manage.py migrate djmailgunNext you have to setup this table for example via admin part of the
site. You have to add two records:1  Firstkey - MAILGUN_ACCESS_KEYvalue - ACCESS-KEY2  Secondkey - MAILGUN_SERVER_NAMEvalue - SERVER-NAMENow, when you usedjango.core.mail.send_mail, Mailgun will send the
messagesLinksBuiltin Email Error ReportingDjangoMailgun
Package: djmako
Mako templates for django >= 1.2.Portions of this code are taken from django-smorgasbord’s mako
support.  Smorgasbord provided a monkeypatch to facilitate the use of
other templating languages within django 1.1; with django 1.2, this
monkeypatch is no longer necessary, and there is no longer any
particular reason to conjoin template loaders for different languages
in one project.To use, add'djmako.MakoLoader'tosettings.TEMPLATE_LOADERS, and
define settings.MAKO_TEMPLATE_DIRS (a tuple of directories in which to
look for mako templates – required) andsettings.MAKO_TEMPLATE_OPTS(a dictionary of other parameters to pass to Mako’sTemplateLookupclass – optional).For instance, insettings.pyyou might have:TEMPLATE_LOADERS = (
   'djmako.MakoLoader',
   'django.template.loaders.filesystem.Loader',
   'django.template.loaders.app_directories.Loader',
)

MAKO_TEMPLATE_DIRS=(os.path.join(PROJECT_ROOT, 'templates', 'mako'),)

MAKO_TEMPLATE_OPTS=dict(input_encoding='utf-8',
                        cache_impl='djmakocache',
                        module_directory=os.path.join(
    tempfile.gettempdir(),
    os.environ.get('LOGNAME', 'someuser'),
    'mysite',
    PROJECT_ROOT.split('/')[-2]))Note that in the above configuration, the mako loader is checked
first, and django templates afterwards.Cache PluginAs of version 0.4, djmako contains a cache plugin for Mako that
connects the Mako cache to the Django cache system.  To enable, set"cache_impl"to"djmakocache"insettings.MAKO_TEMPLATE_OPTS.LicenseCopyright (c) 2010 Jacob Smullyan.
All rights reserved.Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Package: dj_mano
Materialized Annotations for Django Models. Typical use-case is to keep track of the number of
comments in a post, or the number of contributions a user has made.Installationpipinstalldj_manoUsageIn-codeUsing dj_mano is pretty straightforward, you just create a field and give it the annotation you
want it to hold.If you want, you can apply some filter to the annotation you’re doing, like to count only positive
reviews by example. In this case, you can provide a function that will return the queryset that
will be annotated. Beware, the queryset must be “starting” from the object holding the materialized
annotation field.Modelsfromdjango.dbimportmodelsfromdj_manoimportMaterializedAnnotationIntegerFielddefswag_model_c():returnModelA.objects.filter(models_b__models_c__has_swag=True)classModelA(models.Model):count_b=MaterializedAnnotationIntegerField(models.Count('models_b'))count_c=MaterializedAnnotationIntegerField(models.Count('models_b__models_c'))count_swag=MaterializedAnnotationIntegerField(models.Count('models_b__models_c'),swag_model_c)classModelB(models.Model):model_a=models.ForeignKey('ModelA',related_name='models_b')classModelC(models.Model):model_b=models.ForeignKey('ModelB',related_name='models_c')has_swag=models.BooleanField(default=False)urls.pyfromdjango.conf.urlsimportpatternsfromdj_manoimporthook_it_allhook_it_all()urlpatterns=patterns('',...)CommandThere is a command that will simply synchronize all fields to their actual value.Note: if you want to use this command, you have to putdj_manoin yourINSTALLED_APPS../manage.pydj_mano_syncLicenceThis library is licensed under the terms of the WTFPL. Please see the attached LICENSE file.
Package: dj-materialized-views
Django Materialized ViewsOverviewDjango Materialized Views is a powerful admin app that allows you to manage materialized views from the admin panelThe app can:Create, update and delete materialized viewsCreate indexes for the materialized viewsRefresh the materialized views at regular intervalsLimitation:Works only with PostgreSQLRequirementsPython 3.6+Django 2, 3 or 4CeleryInstallationInstall using pippip install dj_materialized_viewsAdd 'django_celery_beat' and 'dj_materialized_views' to your INSTALLED_APPS settingINSTALLED_APPS = [
    ...
    'django_celery_beat',
    'dj_materialized_views',
]DocumentationFor more information on how to use the app, see the documentation at:https://dj-materialized-views.readthedocs.io/en/latest/quick_start/
Package: djmemcache
An efficient fast Django Memcached backend with a pool of connectors, based on
pymemcache.Seehttps://github.com/zhumengyuan/djmemcacheEach connection added in the pool stays connected to Memcache or Membase,
drastically limiting the number of reconnections and open sockets your
application will use on high load.If you configure more than one Memcache server, each new connection
will randomly pick one.Everytime a socket timeout occurs on a server, it’s blacklisted so
new connections avoid picking it for a while.To use this backend, make sure the package is installed in your environment
then usedjmemcache.backend.PyMemcacheCacheas backend in your settings.Here’s an example:CACHES = {
    'default': {
        'BACKEND': 'djmemcache.backend.PyMemcacheCache',
        'LOCATION': '127.0.0.1:11211',
        'OPTIONS': {
                'MAX_POOL_SIZE': 100,
                'KEY_PREFIX': b'uuboard_prefix',
                'TIMEOUT': 30,
                'CONNECT_TIMEOUT': 30,
                'IGNORE_EXC': True,
                'USE_POOLING': True
            }
        }
    }Options:MAX_POOL_SIZE:– The maximum number of connectors in the pool for eatch host. default: 2 ** 31.KEY_PREFIX– The time in seconds a server stays in the blacklist. default: b’’TIMEOUT– The time in seconds for the socket timeout. defaults to “forever”CONNECT_TIMEOUT– The time in seconds for the connect socket timeout. defaults to “forever”USE_POOLING– Whether to apply the connection pool. defaults to “True”2015-04-30 - 0.1Initial release
Package: dj-micro-auth-connect
service_authA small package to connect microservices and authenticate user. It uses RemoteModel to make http requests with multiple services.
Also used to verify tokens to authenticate users.Quick startInstall the packagepip install dj-micro-auth-connect.Addservice_authin INSTALLED_APPSINSTALLED_APPS = (
    ...
    'service_auth'
)AddENTITY_BASE_URL_MAP = {
    ...
'auth':'url-for-authentication-service.com',

}

ENTITY_URL_PATH = {
    ...
'verify_token':'api/path/for/endpoint',
}Note: Above mentioned keys must be same to get it work.
Package: djmicroservice
djmicroservicedjango restfull框架下的微服务应用包。一. 安装依赖包django >=2.0djangorestframework >=3.8djangorestframework-jwt >=1.6djkeeper >=0.2South >=1.0coreapi >=2.3.3simple-rest-client >=0.5.2stomp.py >=4.1.20安装#pip install -r requirements.txt
 #python setup.py install配置django 配置INSTALLED_APPS配置项增加INSTALLED_APPS = [
 	'django.contrib.auth',
 	'django.contrib.contenttypes',
 	'django.contrib.sessions',
 	'django.contrib.messages',
 	'django.contrib.staticfiles',    
 	'rest_framework',
 	'djmicroservice',
 ]增加 REST_FRAMEWORK配置项REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': (
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
    ),
}增加 REST_FRAMEWORK配置项REST_FRAMEWORK = {
 	'DEFAULT_PERMISSION_CLASSES': (
 	),
 	'DEFAULT_AUTHENTICATION_CLASSES': (
 		'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
 	),
 }增加 JWT_AUTH配置项JWT_AUTH = {
 	'JWT_ENCODE_HANDLER':'rest_framework_jwt.utils.jwt_encode_handler',		
 	'JWT_DECODE_HANDLER':'rest_framework_jwt.utils.jwt_decode_handler',		
 	'JWT_PAYLOAD_HANDLER':'user.jwt.handlers.onlyuser_jwt_payload_handler',		
 	'JWT_PAYLOAD_GET_USER_ID_HANDLER':'rest_framework_jwt.utils.jwt_get_user_id_from_payload_handler',		
 	'JWT_RESPONSE_PAYLOAD_HANDLER':'user.jwt.handlers.onlyuser_jwt_response_payload_handler',		
 	'JWT_SECRET_KEY': SECRET_KEY,
 	'JWT_GET_USER_SECRET_KEY': None,
 	'JWT_PUBLIC_KEY': None,
 	'JWT_PRIVATE_KEY': None,
 	'JWT_ALGORITHM': 'HS256',
 	'JWT_VERIFY': True,
 	'JWT_VERIFY_EXPIRATION': True,
 	'JWT_LEEWAY': 0,
 	'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=36000),
 	'JWT_AUDIENCE': None,
 	'JWT_ISSUER': None,		
 	'JWT_ALLOW_REFRESH': True,
 	'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),		
 	'JWT_AUTH_HEADER_PREFIX': 'JWT',
 	'JWT_AUTH_COOKIE': None,		
 }增加 DJMICROSERVICE配置项DJMICROSERVICE = { 
 	#微服务名字
 	'NAME': DEFAULT_NAME ,
 	#微服务URL
 	'URL': 'http://127.0.0.1:8000/',
 	#是否是主节点
 	'MASTER': True, 
 	#微服务资源
 	'RESOURCES': {        
 	}, 
 	#服务发现配置 
 	'DISCOVER': {
 		#是否注册
 		'REGISTER': False,
 		#心跳
 		'HEARTBEAT': 15,
 		#发现者引擎 
 		'ENGINE': 'djmicroservice.discovers.backends.StaticDiscover',
 		#引擎配置
 		'OPTIONS': {
 			'SERVICES':[
 			]
 		},
 	},
 	#客户端配置
 	'CLIENT':{        
 		#认证管理微服务名
 		'AUTH': None,
 		'OBTAIN': None,
 		'REFRESH': None,
 		'VERIFY': None,
 		'USER': None,
 		'PASSWORD': None,
 		'JWT_HEADER_PFX': 'JWT',
 		'TIMEOUT': 2,
 		'AUTO_LOGIN': False,
 	},  
 	#消息队列端配置  
 	'MQ':{
 		#消息队列引擎
 		'ENGINE': 'djmicroservice.mq.backends.ActiveMQ',
 		#引擎配置
 		'OPTIONS': {
 			#消息服务器地址,可以多个
 			'SERVERS': [('127.0.0.1',61613)],
 			#消息服务器登录名
 			'USER': 'admin',
 			#消息服务器密码
 			'PASSWORD': 'admin',
 		},
 		'HANDLERS': { 
 		},
 	},
 	'SERVICE_MANAGER':{
 		#服务管理地址
 		'BIND':('127.0.0.1',56560),
 		'AUTH_KEY':None,
 		#要启动的服务
 		'SERVICES':[        
 			('onlyuser.mq.service.MQService', 1),
 		]
 	}
 }二. RESTful API规范
Package: djmicrosip
=====Django djmicrosip core=====djmicrosip_VERSION = 2014=====load apps====='django_dynamic_models',# MODULOS djmicrosip# Otros'djmicrosip.comun.general','djmicrosip.comun.listas','djmicrosip.comun.impuestos','djmicrosip.comun.direcciones','djmicrosip.comun.clientes','djmicrosip.comun.articulos',# Inventarios'djmicrosip.inventarios.inventarios_catalogos','djmicrosip.inventarios.inventarios_documentos','djmicrosip.inventarios.inventarios_otros',# Ventas'djmicrosip.ventas.ventas_documentos',# Punto de ventas'djmicrosip.punto_de_venta.punto_de_venta_listas','djmicrosip.punto_de_venta.punto_de_venta_documentos',# Contabilidad'djmicrosip.contabilidad.contabilidad_catalogos','djmicrosip.contabilidad.contabilidad_listas','djmicrosip.contabilidad.contabilidad_documentos','ejemplo',=====load djmicrosip databases====='''DATABASE_ROUTERS = ['djmicrosip.utils.db.databases_routers.MainRouter']from djmicrosip.utils.db.multiple_db import ConnectionDatabases as djmicrosip_databasesDATABASES = djmicrosip_databases().get_connections_dic()'''
Package: dj-mixins
mixinsCustom Django mixins for class based viewsGetting startedInstallmixins:pipinstalldj-mixinsNow you can start using the mixins.UsageLet's say that we want to implement a view that accepts requests from superusers only. To achieve this we can useSuperUserMixin:""" Views.py """fromdjango.views.genericimportTemplateViewfrommixins.mixinsimportSuperUserMixin# Create your views here.classSuperUserView(SuperUserMixin,TemplateView):""" A view that accepts request from superusers only """template_name='myapp/index.html'I hope that you find this useful.
Package: djmodelcron
What’s that?Is a library that you can use to attach programmed executions of a
method in the instances of any model in your django applications.How to useInstall djmodelcron and django-recurrence.You need to add a generic relation to the cron model of the djmodelcron app.Using itINSTALLED_APPS=(...'djmodelcron','recurrence',)# In your models.pyfromdjmodelcron.modelsimportCronclassMyModel(models.Model):title=models.CharField(max_length=125)cron=generic.GenericRelation(Cron)defrun(self):print"This is call every time associated cron is executed"
Package: dj-monaco
django widget for monaco editorDocumentationThe full documentation is athttps://dj-monaco.readthedocs.io.QuickstartInstall django widget for monaco editor:pip install dj-monacoAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'djmonaco.apps.DjMonacoConfig',...)Add django widget for monaco editor’s URL patterns:fromdjmonacoimporturlsasdjmonaco_urlsurlpatterns=[...url(r'^',include(djmonaco_urls)),...]FeaturesTODORunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxDevelopment commandspip install -r requirements_dev.txt
invoke -lCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2021-09-16)First release on PyPI.
Package: djmongo
djmongois yet anothermongodbadapter forDjango. This one however, is
build directly onpymongo, tries to be as small and simple as possible and
mimicsDjango’s ORM (managers/querysets).djmongosupportsDjango>= 1.3.InstallationTo installdjmongosimply run:pip install djmongoConfigurationdjmongoprovidesdatabase engineso configuration is rather
straight-forward:DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'database.sqlite',
        'TEST_NAME': ':memory:',
    },

    'mongodb': {
        'ENGINE': 'djmongo.backend.mongodb',
        'NAME': 'testdb',
    }
}In above example we addedmongodbaliased connection to local mongodb
server.UsageCreate a document:from djmongo.document import Document

class MyDocument(Document):

    class Meta:
        using = 'mongodb'

doc1 = MyDocument.objects.create(data={'foo': 'bar'})
doc2 = MyDocument.objects.create(data={'foo': 'baz'})

...TestingIn order to properly test an application, one would like to destroy all objects
inserted during test run between test cases. Normally,Djangodoes that using
transactions, however we need to destroy objects manually. One can do that attearDownmethod using connection’s extra method calledclear_all_collections. Alternatively, one can use subclass ofDjango’sdjango.test.TestCase:djmongo.test.TestCase.DevelopmentWe usegithubfor development of this package (repository, issue tracker).
We also usetoxfor package testing against - if one would like to run whole
test suite against all supportedDjangoversions, simplyclonerepository and
runtoxcommand within it (pip install toxif it’s missing).(Un)licenseThis is free and unencumbered software released into the public domain.Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.For more information, please refer to <http://unlicense.org/>
Package: dj-mongo-backend
This package is a fork ofdjongo, based on the Github version of 22 jan 2023.Use Mongodb as a backend database for your django project, without changing a
single django model!UsageInstall djongo:pip install dj-mongo-backendInto settings.py file of your project, add:DATABASES = {
     'default': {
         'ENGINE': 'djongo',
         'NAME': 'your-db-name',
     }
 }Run (ONLY the first time to create collections in mongoDB):manage.py makemigrations
manage.py migrateYOUR ARE SET! HAVE FUN!RequirementsDjongo requires python 3.6 or above.How it worksDjongo is a SQL to mongodb query transpiler. It translates a SQL query string
into a mongoDB query document. As a result, all Django features, models etc
work as is.Django contrib modules:'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',and others… fully supported.Important linksFull DocumentationSource code
Package: dj-mongo-database-url
Build Status:Master: [![Build Status (master)](https://travis-ci.org/RyanBalfanz/django-mongo-database-url.png?branch=master)](https://travis-ci.org/RyanBalfanz/django-mongo-database-url)Develop: [![Build Status (develop)](https://travis-ci.org/RyanBalfanz/django-mongo-database-url.png?branch=develop)](https://travis-ci.org/RyanBalfanz/django-mongo-database-url)This is a copycat of kennethreitz/dj-database-url specifically for MongoDB URIs.Installationpip install dj-mongo-database-url
Package: djmongoengine
Django MongoEngineThis package, unlikeDjango-MongoEngineorDjongo, doesn't aim on changing SQL role in Django. Writing backend for NoSQL database is not trivial. Here MongoDB is used as helper database, to increase performance.InstallationTo install the package bypiprun following command# From Github$pipinstallgit+https://github.com/giorgi94/djmongoengine.gitUsageTo start using the package, adddjmongoenginetoINSTALLED_APPSand defineMONGODB_DATABASES# settings.pyINSTALLED_APPS=[...djmongoengine...]MONGODB_DATABASES={"default":{"name":"dbname","host":'127.0.0.1',"port":27017,"tz_aware":True,# "username": "user",# "password": "pass"},}Package provides mixin for document schema and connector# models.pyclassDocumentMixin:@classmethoddefUpdateOne(cls,instance):# updates document in MongoDB, which corresponeds to django instance@classmethoddeffrom_instance(cls,instance):# create mongoengine document based on django instanceWe assume that djangoinstance.idis stored inID, sinceidreturns_idfrom mongodb. In theexample, we provide basic example to define mongoengine schema, based on django models# myapp/models.pyclassCategory(models.Model):title=models.CharField(max_length=50,unique=True)alias=models.CharField(max_length=50)# myapp/mongo.pyclassCategory(EmbeddedDocument):ID=fields.IntField()title=fields.StringField()alias=fields.StringField()@classmethoddeffrom_instance(cls,instance):returncls(ID=instance.id,title=instance.title,alias=instance.alias)Insignals.pyandreceivers.pyare defined functions and signals to sync changes in django to mongodb.GraphQLGraphQL is not directly connected with the package, but documentation forgrapheneis not beginner friendly. There aregraphene-djangoandflask-graphql, but it doesn't allow to explore full potential ofgraphqlandmongodb, so we usegraphene-mongofor more diversity. Query is defined in# myapp/query.pyclassQuery(graphene.ObjectType):articles=graphene.List(ArticleQuery,find=FindInput())defresolve_articles(self,info,**kwargs):find=kwargs.get("find")normilize_find(find)iffindisnotNone:returnArticle.objects(**find)returnArticle.objects()schema=graphene.Schema(query=Query)# myapp/views.pyfrom.queryimportschemadefgraphql_view(request):...result=schema.execute(query)ifresult.errors:returnJsonResponse({"errors":str(result.errors)})returnJsonResponse({"query":result.data})
Package: dj-mongohq-url
This simple Django utility allows you to utilize the12factorinspiredMONGOURL_URLenvironment variable to configure your Django application.This is a slight adaptation of the dj-database-url by Kenneth Reitz
(http://github.com/kennethreitz/dj-database-url/). It is compatible withdjango-nonreland can be used to dig up the URL setting for other purposes
as well.UsageConfigure your database insettings.pyfromDATABASE_URL:DATABASES = {'default': dj_mongohq_url.config()}Parse an arbitrary Database URL:DATABASES = {'default': dj_mongohq_url.parse('mongodb://...')}If you are not using Django with nonrel capabilities and merely want to
dig up the MongoDB settings, use another variable:MONGODB = dj_mongohq_url.config()Supported databasesSupport currently exists for MongoDB.