A safer way to share sensitive information (secret messages, passwords, private links, etc.) with others. The secret you want to share with somebody is encrypted and can only be viewed once. It will be burnt once it has been read. You may consider it like a self-destructing message.
You can run a demo of the app with Docker
and Docker Compose
:
docker-compose build
docker-compose up
Then visit http://localhost:8080
in your browser.
You may even create a superuser inside the Docker machine if you want to access the Django admin site:
docker exec -it django-onetimesecret-django bash
export PYTHONPATH="${PROJECT_ROOT}/example/:${PYTHONPATH}"
python example/manage.py createsuperuser
This is an add-on for Django and requires Django >= 2.0 and Python >= 3.6.
You can install this add-on by running pip install django-onetimesecret
and adding it to
the list of installed apps:
INSTALLED_APPS = [
"onetimesecret.apps.OneTimeSecretConfig",
"bootstrap4",
...
]
If you overwrite all the templates and don't want to use Bootstrap 4 you don't need
add bootstrap4
to settings.INSTALLED_APPS
.
Finally add the urls to your urls.py
:
urlpatterns = [
path("wherever/", include("onetimesecret.urls"))
...
]
Finally you need to apply the database migrations.
There are a couple of other apps doing about the same e.g. https://onetimesecret.com. I wanted to host my own secret sharing app but https://onetimesecret.com is built with Ruby On Rails whilst I feel much comfortable with Python and Django.
Furthermore I wanted to integrate lots of the new tools in the Python ecosystem:
- Dependency management with
pipenv
- Code formatting with
black
- Code testing with
webtest
- Code coverage with
coveralls
- Package versioning following
CalVer
- Python packaging with
flit
andbumpversion
- Continuous integration with
Travis CI
Format your code with the command black .
and make sure that the command flake8
does not complain.
You can run the tests by simply executing pytest
. pytest --cov
shows the code coverage and
pytest --cov-report=html
generates a HTML report of the code coverage.
This project can be built with flit
which removes the need to keep a setup.py
. The problem
with a missing setup.py
is, that the package cannot be installed as an editable
package directly from GitHub. For this to work we still need to provide a setup.py
, but we can
use the setup.py
generated by flit
during the build process. Here's another caveat: if
we have a setup.py
, flit
will use it and not generate the file. So if we ever change the
pyproject.toml
file, we need to delete the existing setup.py
, run flit build
and copy
the setup.py
from the .tar.gz
file generated by flit
.