Skip to content

Commit

Permalink
added python publish and fix to connection handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mlodic committed Sep 19, 2022
1 parent f4bfb1a commit bb621b0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
11 changes: 5 additions & 6 deletions djongo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,11 @@ def get_new_connection(self, connection_params):
# To prevent leaving unclosed connections behind,
# client_conn must be closed before a new connection
# is created.
if self.client_connection is not None:
self.client_connection.close()
logger.debug('Existing MongoClient connection closed')

self.client_connection = Database.connect(db=name, **connection_params)
logger.debug('New Database connection')
if self.client_connection:
logger.debug('Using already existing connection')
else:
self.client_connection = Database.connect(db=name, **connection_params)
logger.debug('New Database connection')

database = self.client_connection[name]
self.djongo_connection = DjongoClient(database, es)
Expand Down
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

LONG_DESCRIPTION = """
This is a Fork from Certego S.R.L.
Use Mongodb as a backend database for your django project, without changing a
single django model!
Expand Down Expand Up @@ -84,21 +86,21 @@ def find_version(*file_paths):

install_requires = [
'sqlparse==0.4.2',
'pymongo>=3.2.0,<4.0.0',
'pymongo>=3.2.0,<5.0.0',
'django>=2.1',
]

if sys.version_info.major == 3 and sys.version_info.minor < 7:
install_requires.append("dataclasses")

setup(
name='djongo',
name='djongo-certego',
version=find_version("djongo", "__init__.py"),
include_package_data=True,
packages=packages,
url='https://www.djongomapper.com/',
license='AGPL',
author='doableware',
author='Certego S.R.L.',
author_email='[email protected]',
description=(
'Driver for allowing Django to use MongoDB as the database backend.'),
Expand Down

0 comments on commit bb621b0

Please sign in to comment.