Skip to content

Commit

Permalink
Merge branch 'master' into Multiple-backup-storage-backends-jazzband#235
Browse files Browse the repository at this point in the history
  • Loading branch information
mjlabe authored Jan 11, 2022
2 parents 6465092 + 3a4cdbf commit 955005c
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 88 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ Explain value.

## Checklist

- [ ] Tests are passing
- [ ] Documentation has been added or amended for this feature / update
14 changes: 5 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Running unittests
name: Lint and Unit Test

on:
push:
Expand All @@ -12,9 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
django: ["2.2", "3.0", "3.1"]

python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -28,8 +26,6 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Linting
run: flake8
- name: Run unittests
env:
TOX_ENV: py${{ matrix.python-version}}-django${{ matrix.django }}
run: |
tox -e $TOX_ENV
# Environments are selected using tox-gh-actions configuration in tox.ini.
- name: Test with tox
run: tox
50 changes: 28 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
Django Database Backup
======================

.. image:: https://api.travis-ci.org/django-dbbackup/django-dbbackup.svg
:target: https://travis-ci.org/django-dbbackup/django-dbbackup
.. image:: https://github.com/django-dbbackup/django-dbbackup/actions/workflows/build.yml/badge.svg
:target: https://github.com/django-dbbackup/django-dbbackup/actions

.. image:: https://readthedocs.org/projects/django-dbbackup/badge/?version=latest
:target: http://django-dbbackup.readthedocs.io/
.. image:: https://readthedocs.org/projects/django-dbbackup/badge/?version=stable
:target: https://django-dbbackup.readthedocs.io/
:alt: Documentation Status

.. image:: https://coveralls.io/repos/django-dbbackup/django-dbbackup/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/django-dbbackup/django-dbbackup?branch=master

.. image:: https://landscape.io/github/django-dbbackup/django-dbbackup/master/landscape.svg?style=flat
:target: https://landscape.io/github/django-dbbackup/django-dbbackup/master
:alt: Code Health


This Django application provides management commands to help backup and
restore your project database and media files with various storages such as
Amazon S3, Dropbox, local file storage or any Django storage.
Expand All @@ -31,7 +26,7 @@ It is made for:
Docs
====

See our offical documentation at `Read The Docs`_.
See our official documentation at `Read The Docs`_.

Why use DBBackup
================
Expand Down Expand Up @@ -149,21 +144,17 @@ Contributing
============

All contribution are very welcomed, propositions, problems, bugs and
enhancement are tracked with `GitHub issues`_ system and patch are submitted
enhancement are tracked with `GitHub issues`_ system and patches are submitted
via `pull requests`_.

We use `Travis`_ coupled with `Coveralls`_ as continious integration tools.
We use GitHub Actions as continuous integration tools.

.. _`Read The Docs`: http://django-dbbackup.readthedocs.org/
.. _`Read The Docs`: https://django-dbbackup.readthedocs.org/
.. _`GitHub issues`: https://github.com/django-dbbackup/django-dbbackup/issues
.. _`pull requests`: https://github.com/django-dbbackup/django-dbbackup/pulls
.. _Travis: https://travis-ci.org/django-dbbackup/django-dbbackup
.. _`GitHub Actions`: https://github.com/django-dbbackup/django-dbbackup/actions
.. _Coveralls: https://coveralls.io/github/django-dbbackup/django-dbbackup


.. image:: https://ga-beacon.appspot.com/UA-87461-7/django-dbbackup/home
:target: https://github.com/igrigorik/ga-beacon

Tests
=====

Expand All @@ -182,7 +173,7 @@ are available. So you could launch:

For get a Python shell configured with the test project. Also all test
command options are available and usable for run only some chosen tests.
See `Django test command documentation`_ for more informations about it.
See `Django test command documentation`_ for more information about it.

.. _`Django test command documentation`: https://docs.djangoproject.com/en/stable/topics/testing/overview/#running-tests

Expand All @@ -201,11 +192,26 @@ can use Tox. Firstly install Tox:

To run the tests just use the command ``tox`` in the command line. If you
want to run the tests against just one specific test environment you can run
``tox -e <testenv>``. For example, to run the tests with Python3.3 and
Django1.9 you would run:
``tox -e <testenv>``. For example, to run the tests with Python3.9 and
Django3.2 you would run:

::

tox -e py3.3-django1.9
tox -e py3.9-django3.2

The available test environments can be found in ``tox.ini``.

Publishing
==========

To build a source distribution and wheel:

::

tox -e build

To publish to PyPI:

::

tox -e upload
13 changes: 6 additions & 7 deletions dbbackup/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"Management commands to help backup and restore a project database and media"
VERSION = (3, 3, 0)
__version__ = '.'.join([str(i) for i in VERSION])
__author__ = 'Michael Shepanski'
__email__ = '[email protected]'
__url__ = 'https://github.com/django-dbbackup/django-dbbackup'
default_app_config = 'dbbackup.apps.DbbackupConfig'
"""Management commands to help backup and restore a project database and media"""

import django

if django.VERSION < (3, 2):
default_app_config = 'dbbackup.apps.DbbackupConfig'
4 changes: 4 additions & 0 deletions dbbackup/db/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def _create_dump(self):
cmd += ' --username {}'.format(self.settings['USER'])
if self.settings.get('PASSWORD'):
cmd += ' --password {}'.format(utils.get_escaped_command_arg(self.settings['PASSWORD']))
if self.settings.get('AUTH_SOURCE'):
cmd += ' --authenticationDatabase {}'.format(self.settings['AUTH_SOURCE'])
for collection in self.exclude:
cmd += ' --excludeCollection {}'.format(collection)
cmd += ' --archive'
Expand All @@ -37,6 +39,8 @@ def _restore_dump(self, dump):
cmd += ' --username {}'.format(self.settings['USER'])
if self.settings.get('PASSWORD'):
cmd += ' --password {}'.format(utils.get_escaped_command_arg(self.settings['PASSWORD']))
if self.settings.get('AUTH_SOURCE'):
cmd += ' --authenticationDatabase {}'.format(self.settings['AUTH_SOURCE'])
if self.object_check:
cmd += ' --objcheck'
if self.drop:
Expand Down
16 changes: 5 additions & 11 deletions dbbackup/tests/testapp/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
try:
from django.conf.urls import patterns, include, url
urlpatterns = patterns(
'',
# url(r'^admin/', include(admin.site.urls)),
)
except ImportError:
from django.conf.urls import include, url
urlpatterns = (
# url(r'^admin/', include(admin.site.urls)),
)
from django.urls import include, re_path

urlpatterns = (
# url(r'^admin/', include(admin.site.urls)),
)
40 changes: 28 additions & 12 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
Changelog
=====
=========

Unreleased
-----------
4.0.0b0 (2021-12-19)
--------------------

* Fix RemovedInDjango41Warning related to default_app_config `#413`_
* Add authentication database support for MongoDB `#379`_
* Remove six dependency `#371`_
* Explicitly support Python 3.6+. `#408`_
* Drop support for end of life Django versions. Currently support 2.2, 3.2, 4.0. `#408`_
* Replace ugettext_lazy with gettext_lazy `#342`_
* Documentation fixes `#341`_ `#333`_ `#349`_ `#348`_ `#337`_
* Changed logging settings from settings.py to late init `#332`_
* Fix authentication error when postgres is password protected `#361`_
* Use exclude-table-data instead of exclude-table `#363`_
* Add support for exclude tables data in the command interface `#375`_
* Move author and version information into setup.py to allow building package in isolated
environment (e.g. with the ``build`` package). `#414`_
* Documentation fixes `#341`_ `#333`_ `#349`_ `#348`_ `#337`_ `#411`_


3.3.0
------
3.3.0 (2020-04-14)
------------------

* Documentation fixes `#341`_ `#333`_ `#328`_ `#320`_ `#305`_ `#303`_ `#302`_ `#298`_ `#281`_ `#266`_ `#349`_ `#348`_ `#337`_
* "output-filename" in mediabackup command `#324`_
Expand All @@ -21,6 +33,10 @@ Unreleased
* Quick fix for proper selection of DB name to restore `#260`_

.. _`#342`: https://github.com/django-dbbackup/django-dbbackup/pull/342
.. _`#332`: https://github.com/django-dbbackup/django-dbbackup/pull/332
.. _`#361`: https://github.com/django-dbbackup/django-dbbackup/pull/361
.. _`#363`: https://github.com/django-dbbackup/django-dbbackup/pull/363
.. _`#375`: https://github.com/django-dbbackup/django-dbbackup/pull/375
.. _`#341`: https://github.com/django-dbbackup/django-dbbackup/pull/341
.. _`#333`: https://github.com/django-dbbackup/django-dbbackup/pull/333
.. _`#328`: https://github.com/django-dbbackup/django-dbbackup/pull/328
Expand All @@ -42,9 +58,9 @@ Unreleased
.. _`#349`: https://github.com/django-dbbackup/django-dbbackup/pull/349
.. _`#348`: https://github.com/django-dbbackup/django-dbbackup/pull/348
.. _`#337`: https://github.com/django-dbbackup/django-dbbackup/pull/337
.. _`#`:
.. _`#`:
.. _`#`:
.. _`#`:
.. _`#`:
.. _`#`:_
.. _`#408`: https://github.com/django-dbbackup/django-dbbackup/pull/408
.. _`#371`: https://github.com/django-dbbackup/django-dbbackup/pull/371
.. _`#379`: https://github.com/django-dbbackup/django-dbbackup/pull/379
.. _`#411`: https://github.com/django-dbbackup/django-dbbackup/pull/411
.. _`#413`: https://github.com/django-dbbackup/django-dbbackup/pull/413
.. _`#414`: https://github.com/django-dbbackup/django-dbbackup/pull/414
19 changes: 19 additions & 0 deletions docs/databases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,25 @@ MongoDB
MongoDB uses by default :class:`dbbackup.db.mongodb.MongoDumpConnector`. it
uses ``mongodump`` and ``mongorestore`` for its job.

For AuthEnabled MongoDB Connection, you need to add one custom option ``AUTH_SOURCE`` in your ``DBBACKUP_CONNECTORS``. ::

DBBACKUP_CONNECTORS = {
'default': {
...
'AUTH_SOURCE': 'admin',
}
}

Or in ``DATABASES`` one: ::

DATABASES = {
'default': {
...
'AUTH_SOURCE': 'admin',
}
}


OBJECT_CHECK
~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytz
Django>=1.5
Django>=2.2
29 changes: 18 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python

from pathlib import Path

from setuptools import setup, find_packages
import dbbackup


def get_requirements():
Expand All @@ -11,41 +13,46 @@ def get_test_requirements():
return open('requirements-tests.txt').read().splitlines()


project_dir = Path(__file__).parent


keywords = [
'django', 'database', 'media', 'backup',
'amazon', 's3' 'dropbox',
]

setup(
name='django-dbbackup',
version=dbbackup.__version__,
description=dbbackup.__doc__,
author=dbbackup.__author__,
author_email=dbbackup.__email__,
version="4.0.0b0",
description='Management commands to help backup and restore a project database and media',
author='Michael Shepanski',
author_email='[email protected]',
long_description=project_dir.joinpath("README.rst").read_text(encoding="utf-8"),
python_requires=">=3.6",
install_requires=get_requirements(),
tests_require=get_test_requirements(),
license='BSD',
url=dbbackup.__url__,
url='https://github.com/django-dbbackup/django-dbbackup',
keywords=keywords,
packages=find_packages(),
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Environment :: Console',
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Database',
'Topic :: System :: Archiving',
'Topic :: System :: Archiving :: Backup',
Expand Down
Loading

0 comments on commit 955005c

Please sign in to comment.