From 8dc4027941058458a7552e747040bfd17048577e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Val=C3=A9rio?= Date: Tue, 24 Sep 2019 18:02:54 +0100 Subject: [PATCH] Initial commit. Cookiecutter based project structure --- .coveragerc | 11 + .editorconfig | 23 ++ .github/ISSUE_TEMPLATE.md | 16 ++ .github/PULL_REQUEST_TEMPLATE.md | 27 ++ .gitignore | 47 ++++ .travis.yml | 23 ++ AUTHORS.rst | 13 + CONTRIBUTING.rst | 112 ++++++++ HISTORY.rst | 9 + LICENSE | 14 + MANIFEST.in | 6 + Makefile | 59 ++++ README.rst | 76 ++++++ django_cryptolock/__init__.py | 1 + django_cryptolock/apps.py | 6 + django_cryptolock/models.py | 12 + .../static/css/django_cryptolock.css | 0 django_cryptolock/static/img/.gitignore | 0 .../static/js/django_cryptolock.js | 0 .../templates/django_cryptolock/base.html | 21 ++ django_cryptolock/urls.py | 35 +++ django_cryptolock/views.py | 38 +++ docs/Makefile | 177 ++++++++++++ docs/authors.rst | 1 + docs/conf.py | 254 ++++++++++++++++++ docs/contributing.rst | 1 + docs/history.rst | 1 + docs/index.rst | 19 ++ docs/installation.rst | 12 + docs/make.bat | 242 +++++++++++++++++ docs/readme.rst | 1 + docs/usage.rst | 26 ++ example/README.md | 24 ++ example/example/__init__.py | 0 example/example/settings.py | 120 +++++++++ example/example/urls.py | 23 ++ example/example/wsgi.py | 16 ++ example/manage.py | 10 + example/requirements.txt | 5 + example/templates/django_cryptolock/base.html | 88 ++++++ manage.py | 12 + requirements.txt | 2 + requirements_dev.txt | 3 + requirements_test.txt | 8 + runtests.py | 26 ++ setup.cfg | 22 ++ setup.py | 77 ++++++ tests/__init__.py | 0 tests/settings.py | 33 +++ tests/test_models.py | 25 ++ tests/urls.py | 9 + tox.ini | 16 ++ 52 files changed, 1802 insertions(+) create mode 100644 .coveragerc create mode 100644 .editorconfig create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 AUTHORS.rst create mode 100644 CONTRIBUTING.rst create mode 100644 HISTORY.rst create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 Makefile create mode 100644 README.rst create mode 100644 django_cryptolock/__init__.py create mode 100644 django_cryptolock/apps.py create mode 100644 django_cryptolock/models.py create mode 100644 django_cryptolock/static/css/django_cryptolock.css create mode 100644 django_cryptolock/static/img/.gitignore create mode 100644 django_cryptolock/static/js/django_cryptolock.js create mode 100644 django_cryptolock/templates/django_cryptolock/base.html create mode 100644 django_cryptolock/urls.py create mode 100644 django_cryptolock/views.py create mode 100644 docs/Makefile create mode 100644 docs/authors.rst create mode 100644 docs/conf.py create mode 100644 docs/contributing.rst create mode 100644 docs/history.rst create mode 100644 docs/index.rst create mode 100644 docs/installation.rst create mode 100644 docs/make.bat create mode 100644 docs/readme.rst create mode 100644 docs/usage.rst create mode 100644 example/README.md create mode 100644 example/example/__init__.py create mode 100644 example/example/settings.py create mode 100644 example/example/urls.py create mode 100644 example/example/wsgi.py create mode 100755 example/manage.py create mode 100644 example/requirements.txt create mode 100644 example/templates/django_cryptolock/base.html create mode 100644 manage.py create mode 100644 requirements.txt create mode 100644 requirements_dev.txt create mode 100644 requirements_test.txt create mode 100644 runtests.py create mode 100644 setup.cfg create mode 100755 setup.py create mode 100644 tests/__init__.py create mode 100644 tests/settings.py create mode 100644 tests/test_models.py create mode 100644 tests/urls.py create mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..0f49c0e --- /dev/null +++ b/.coveragerc @@ -0,0 +1,11 @@ +[run] +branch = true + +[report] +omit = + *site-packages* + *tests* + *.tox* +show_missing = True +exclude_lines = + raise NotImplementedError diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..585e2ab --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{py,rst,ini}] +indent_style = space +indent_size = 4 + +[*.{html,css,scss,json,yml}] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..3f3ce18 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,16 @@ +* Django-Cryptolock version: +* Django version: +* Python version: +* Operating System: + +### Description + +Describe what you were trying to get done. +Tell us what happened, what went wrong, and what you expected to happen. + +### What I Did + +``` +Paste the command(s) you ran and the output. +If there was a crash, please include the traceback here. +``` diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5d2fa64 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,27 @@ +**Description:** Describe in a couple of sentences what this PR adds + +**Issue:** Link related issue + +**Dependencies:** dependencies on other outstanding PRs, issues, etc. + +**Installation instructions:** List any non-trivial installation +instructions. + +**Testing instructions:** + +1. Open page A +2. Do thing B +3. Expect C to happen +4. If D happened instead - check failed. + +**Merge checklist:** + +- [ ] All reviewers approved +- [ ] CI build is green +- [ ] Version bumped +- [ ] Changelog record added +- [ ] Documentation updated (not only docstrings) + +**Author concerns:** List any concerns about this PR - inelegant +solutions, hacks, quick-and-dirty implementations, concerns about +migrations, etc. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9928c23 --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +*.py[cod] +__pycache__ + +# C extensions +*.so + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml +htmlcov + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Pycharm/Intellij +.idea + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +docs/_build diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c2bcf5b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +# Config file for automatic testing at travis-ci.org + +language: python + +python: + - "3.6" + +env: + - TOX_ENV=py36-django-20 + - TOX_ENV=py35-django-20 + - TOX_ENV=py34-django-20 + +matrix: + fast_finish: true + +# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors +install: pip install -r requirements_test.txt + +# command to run tests using coverage, e.g. python setup.py test +script: tox -e $TOX_ENV + +after_success: + - codecov -e TOX_ENV diff --git a/AUTHORS.rst b/AUTHORS.rst new file mode 100644 index 0000000..4a0e9a5 --- /dev/null +++ b/AUTHORS.rst @@ -0,0 +1,13 @@ +======= +Credits +======= + +Development Lead +---------------- + +* Gonçalo Valério + +Contributors +------------ + +None yet. Why not be the first? diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..c90466c --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,112 @@ +============ +Contributing +============ + +Contributions are welcome, and they are greatly appreciated! Every +little bit helps, and credit will always be given. + +You can contribute in many ways: + +Types of Contributions +---------------------- + +Report Bugs +~~~~~~~~~~~ + +Report bugs at https://github.com/dethos/django-cryptolock/issues. + +If you are reporting a bug, please include: + +* Your operating system name and version. +* Any details about your local setup that might be helpful in troubleshooting. +* Detailed steps to reproduce the bug. + +Fix Bugs +~~~~~~~~ + +Look through the GitHub issues for bugs. Anything tagged with "bug" +is open to whoever wants to implement it. + +Implement Features +~~~~~~~~~~~~~~~~~~ + +Look through the GitHub issues for features. Anything tagged with "feature" +is open to whoever wants to implement it. + +Write Documentation +~~~~~~~~~~~~~~~~~~~ + +Django-Cryptolock could always use more documentation, whether as part of the +official Django-Cryptolock docs, in docstrings, or even on the web in blog posts, +articles, and such. + +Submit Feedback +~~~~~~~~~~~~~~~ + +The best way to send feedback is to file an issue at https://github.com/dethos/django-cryptolock/issues. + +If you are proposing a feature: + +* Explain in detail how it would work. +* Keep the scope as narrow as possible, to make it easier to implement. +* Remember that this is a volunteer-driven project, and that contributions + are welcome :) + +Get Started! +------------ + +Ready to contribute? Here's how to set up `django-cryptolock` for local development. + +1. Fork the `django-cryptolock` repo on GitHub. +2. Clone your fork locally:: + + $ git clone git@github.com:your_name_here/django-cryptolock.git + +3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: + + $ mkvirtualenv django-cryptolock + $ cd django-cryptolock/ + $ python setup.py develop + +4. Create a branch for local development:: + + $ git checkout -b name-of-your-bugfix-or-feature + + Now you can make your changes locally. + +5. When you're done making changes, check that your changes pass flake8 and the + tests, including testing other Python versions with tox:: + + $ flake8 django_cryptolock tests + $ python setup.py test + $ tox + + To get flake8 and tox, just pip install them into your virtualenv. + +6. Commit your changes and push your branch to GitHub:: + + $ git add . + $ git commit -m "Your detailed description of your changes." + $ git push origin name-of-your-bugfix-or-feature + +7. Submit a pull request through the GitHub website. + +Pull Request Guidelines +----------------------- + +Before you submit a pull request, check that it meets these guidelines: + +1. The pull request should include tests. +2. If the pull request adds functionality, the docs should be updated. Put + your new functionality into a function with a docstring, and add the + feature to the list in README.rst. +3. The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check + https://travis-ci.org/dethos/django-cryptolock/pull_requests + and make sure that the tests pass for all supported Python versions. + +Tips +---- + +To run a subset of tests:: + + $ python -m unittest tests.test_django_cryptolock diff --git a/HISTORY.rst b/HISTORY.rst new file mode 100644 index 0000000..c7599a7 --- /dev/null +++ b/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +History +------- + +0.0.1 (2019-09-24) +++++++++++++++++++ + +* First release on PyPI. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2c19a27 --- /dev/null +++ b/LICENSE @@ -0,0 +1,14 @@ + +MIT License + +Copyright (c) 2019, Gonçalo Valério + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +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 OR COPYRIGHT HOLDERS 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. + + + + diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..97f4adf --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS.rst +include CONTRIBUTING.rst +include HISTORY.rst +include LICENSE +include README.rst +recursive-include django_cryptolock *.html *.png *.gif *js *.css *jpg *jpeg *svg *py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ebebf9b --- /dev/null +++ b/Makefile @@ -0,0 +1,59 @@ +.PHONY: clean-pyc clean-build docs help +.DEFAULT_GOAL := help +define BROWSER_PYSCRIPT +import os, webbrowser, sys +try: + from urllib import pathname2url +except: + from urllib.request import pathname2url + +webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) +endef +export BROWSER_PYSCRIPT +BROWSER := python -c "$$BROWSER_PYSCRIPT" + +help: + @grep '^[a-zA-Z]' $(MAKEFILE_LIST) | sort | awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' + +clean: clean-build clean-pyc + +clean-build: ## remove build artifacts + rm -fr build/ + rm -fr dist/ + rm -fr *.egg-info + +clean-pyc: ## remove Python file artifacts + find . -name '*.pyc' -exec rm -f {} + + find . -name '*.pyo' -exec rm -f {} + + find . -name '*~' -exec rm -f {} + + +lint: ## check style with flake8 + flake8 django_cryptolock tests + +test: ## run tests quickly with the default Python + python runtests.py tests + +test-all: ## run tests on every Python version with tox + tox + +coverage: ## check code coverage quickly with the default Python + coverage run --source django_cryptolock runtests.py tests + coverage report -m + coverage html + open htmlcov/index.html + +docs: ## generate Sphinx HTML documentation, including API docs + rm -f docs/django-cryptolock.rst + rm -f docs/modules.rst + sphinx-apidoc -o docs/ django_cryptolock + $(MAKE) -C docs clean + $(MAKE) -C docs html + $(BROWSER) docs/_build/html/index.html + +release: clean ## package and upload a release + python setup.py sdist upload + python setup.py bdist_wheel upload + +sdist: clean ## package + python setup.py sdist + ls -l dist diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..ce6f1c7 --- /dev/null +++ b/README.rst @@ -0,0 +1,76 @@ +============================= +Django-Cryptolock +============================= + +.. image:: https://badge.fury.io/py/django-cryptolock.svg + :target: https://badge.fury.io/py/django-cryptolock + +.. image:: https://travis-ci.org/dethos/django-cryptolock.svg?branch=master + :target: https://travis-ci.org/dethos/django-cryptolock + +.. image:: https://codecov.io/gh/dethos/django-cryptolock/branch/master/graph/badge.svg + :target: https://codecov.io/gh/dethos/django-cryptolock + +Django authentication using cryptocurrency wallets + +Documentation +------------- + +The full documentation is at https://django-cryptolock.readthedocs.io. + +Quickstart +---------- + +Install Django-Cryptolock:: + + pip install django-cryptolock + +Add it to your `INSTALLED_APPS`: + +.. code-block:: python + + INSTALLED_APPS = ( + ... + 'django_cryptolock.apps.DjangoCryptolockConfig', + ... + ) + +Add Django-Cryptolock's URL patterns: + +.. code-block:: python + + from django_cryptolock import urls as django_cryptolock_urls + + + urlpatterns = [ + ... + url(r'^', include(django_cryptolock_urls)), + ... + ] + +Features +-------- + +* TODO + +Running Tests +------------- + +Does the code actually work? + +:: + + source /bin/activate + (myenv) $ pip install tox + (myenv) $ tox + +Credits +------- + +Tools used in rendering this package: + +* Cookiecutter_ +* `cookiecutter-djangopackage`_ + +.. _Cookiecutter: https://github.com/audreyr/cookiecutter +.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage diff --git a/django_cryptolock/__init__.py b/django_cryptolock/__init__.py new file mode 100644 index 0000000..b8023d8 --- /dev/null +++ b/django_cryptolock/__init__.py @@ -0,0 +1 @@ +__version__ = '0.0.1' diff --git a/django_cryptolock/apps.py b/django_cryptolock/apps.py new file mode 100644 index 0000000..a77ac37 --- /dev/null +++ b/django_cryptolock/apps.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 +from django.apps import AppConfig + + +class DjangoCryptolockConfig(AppConfig): + name = 'django_cryptolock' diff --git a/django_cryptolock/models.py b/django_cryptolock/models.py new file mode 100644 index 0000000..21921b8 --- /dev/null +++ b/django_cryptolock/models.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- + +from django.db import models + +from model_utils.models import TimeStampedModel + + +class Address(TimeStampedModel): + pass + + + diff --git a/django_cryptolock/static/css/django_cryptolock.css b/django_cryptolock/static/css/django_cryptolock.css new file mode 100644 index 0000000..e69de29 diff --git a/django_cryptolock/static/img/.gitignore b/django_cryptolock/static/img/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/django_cryptolock/static/js/django_cryptolock.js b/django_cryptolock/static/js/django_cryptolock.js new file mode 100644 index 0000000..e69de29 diff --git a/django_cryptolock/templates/django_cryptolock/base.html b/django_cryptolock/templates/django_cryptolock/base.html new file mode 100644 index 0000000..09d26f3 --- /dev/null +++ b/django_cryptolock/templates/django_cryptolock/base.html @@ -0,0 +1,21 @@ + +{% comment %} +As the developer of this package, don't place anything here if you can help it +since this allows developers to have interoperability between your template +structure and their own. + +Example: Developer melding the 2SoD pattern to fit inside with another pattern:: + + {% extends "base.html" %} + {% load static %} + + + {% block extra_js %} + + + {% block javascript %} + + {% endblock javascript %} + + {% endblock extra_js %} +{% endcomment %} diff --git a/django_cryptolock/urls.py b/django_cryptolock/urls.py new file mode 100644 index 0000000..1bc7ebd --- /dev/null +++ b/django_cryptolock/urls.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +from django.conf.urls import url +from django.views.generic import TemplateView + +from . import views + + +app_name = 'django_cryptolock' +urlpatterns = [ + url( + regex="^Address/~create/$", + view=views.AddressCreateView.as_view(), + name='Address_create', + ), + url( + regex="^Address/(?P\d+)/~delete/$", + view=views.AddressDeleteView.as_view(), + name='Address_delete', + ), + url( + regex="^Address/(?P\d+)/$", + view=views.AddressDetailView.as_view(), + name='Address_detail', + ), + url( + regex="^Address/(?P\d+)/~update/$", + view=views.AddressUpdateView.as_view(), + name='Address_update', + ), + url( + regex="^Address/$", + view=views.AddressListView.as_view(), + name='Address_list', + ), + ] diff --git a/django_cryptolock/views.py b/django_cryptolock/views.py new file mode 100644 index 0000000..7b16b14 --- /dev/null +++ b/django_cryptolock/views.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +from django.views.generic import ( + CreateView, + DeleteView, + DetailView, + UpdateView, + ListView +) + +from .models import ( + Address, +) + + +class AddressCreateView(CreateView): + + model = Address + + +class AddressDeleteView(DeleteView): + + model = Address + + +class AddressDetailView(DetailView): + + model = Address + + +class AddressUpdateView(UpdateView): + + model = Address + + +class AddressListView(ListView): + + model = Address + diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..0e35bee --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,177 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/complexity.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/complexity.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/complexity" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/complexity" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/docs/authors.rst b/docs/authors.rst new file mode 100644 index 0000000..e122f91 --- /dev/null +++ b/docs/authors.rst @@ -0,0 +1 @@ +.. include:: ../AUTHORS.rst diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..bae1b36 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,254 @@ +# -*- coding: utf-8 -*- +# +# complexity documentation build configuration file, created by +# sphinx-quickstart on Tue Jul 9 22:26:36 2013. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +cwd = os.getcwd() +parent = os.path.dirname(cwd) +sys.path.append(parent) + +import django_cryptolock + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Django-Cryptolock' +copyright = u'2019, Gonçalo Valério' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = django_cryptolock.__version__ +# The full version, including alpha/beta/rc tags. +release = django_cryptolock.__version__ + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'django-cryptolockdoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'django-cryptolock.tex', u'Django-Cryptolock Documentation', + u'Gonçalo Valério', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'django-cryptolock', u'Django-Cryptolock Documentation', + [u'Gonçalo Valério'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------------ + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'django-cryptolock', u'Django-Cryptolock Documentation', + u'Gonçalo Valério', 'django-cryptolock', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 0000000..e582053 --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1 @@ +.. include:: ../CONTRIBUTING.rst diff --git a/docs/history.rst b/docs/history.rst new file mode 100644 index 0000000..2506499 --- /dev/null +++ b/docs/history.rst @@ -0,0 +1 @@ +.. include:: ../HISTORY.rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..392af46 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,19 @@ +.. complexity documentation master file, created by + sphinx-quickstart on Tue Jul 9 22:26:36 2013. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Django-Cryptolock's documentation! +================================================================= + +Contents: + +.. toctree:: + :maxdepth: 2 + + readme + installation + usage + contributing + authors + history diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 0000000..5f62634 --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,12 @@ +============ +Installation +============ + +At the command line:: + + $ easy_install django-cryptolock + +Or, if you have virtualenvwrapper installed:: + + $ mkvirtualenv django-cryptolock + $ pip install django-cryptolock diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..2df9a8c --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,242 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +set I18NSPHINXOPTS=%SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\complexity.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\complexity.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end diff --git a/docs/readme.rst b/docs/readme.rst new file mode 100644 index 0000000..72a3355 --- /dev/null +++ b/docs/readme.rst @@ -0,0 +1 @@ +.. include:: ../README.rst diff --git a/docs/usage.rst b/docs/usage.rst new file mode 100644 index 0000000..35eb73b --- /dev/null +++ b/docs/usage.rst @@ -0,0 +1,26 @@ +===== +Usage +===== + +To use Django-Cryptolock in a project, add it to your `INSTALLED_APPS`: + +.. code-block:: python + + INSTALLED_APPS = ( + ... + 'django_cryptolock.apps.DjangoCryptolockConfig', + ... + ) + +Add Django-Cryptolock's URL patterns: + +.. code-block:: python + + from django_cryptolock import urls as django_cryptolock_urls + + + urlpatterns = [ + ... + url(r'^', include(django_cryptolock_urls)), + ... + ] diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..87e6733 --- /dev/null +++ b/example/README.md @@ -0,0 +1,24 @@ +##Example Project for django_cryptolock + +This example is provided as a convenience feature to allow potential users to try the app straight from the app repo without having to create a django project. + +It can also be used to develop the app in place. + +To run this example, follow these instructions: + +1. Navigate to the `example` directory +2. Install the requirements for the package: + + pip install -r requirements.txt + +3. Make and apply migrations + + python manage.py makemigrations + + python manage.py migrate + +4. Run the server + + python manage.py runserver + +5. Access from the browser at `http://127.0.0.1:8000` diff --git a/example/example/__init__.py b/example/example/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/example/settings.py b/example/example/settings.py new file mode 100644 index 0000000..3a32ef0 --- /dev/null +++ b/example/example/settings.py @@ -0,0 +1,120 @@ +""" +Django settings for example project. + +Generated by Cookiecutter Django Package + +For more information on this file, see +https://docs.djangoproject.com/en/1.9/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.9/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = "%6vggcu)vklb)$m!&1+epr*p2)z*$p@h@x@b1lp2)oye3#)@vl" + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + + 'django_cryptolock', + + # if your app has other dependencies that need to be added to the site + # they should be added here +] + +MIDDLEWARE_CLASSES = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'example.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates'), ], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'example.wsgi.application' + +# Database +# https://docs.djangoproject.com/en/1.9/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + +# Password validation +# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + +# Internationalization +# https://docs.djangoproject.com/en/1.9/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.9/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/example/example/urls.py b/example/example/urls.py new file mode 100644 index 0000000..6651818 --- /dev/null +++ b/example/example/urls.py @@ -0,0 +1,23 @@ +"""example URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.9/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url, include +from django.contrib import admin + + +urlpatterns = [ + url(r'^admin/', admin.site.urls), + url(r'', include('django_cryptolock.urls', namespace='django_cryptolock')), +] diff --git a/example/example/wsgi.py b/example/example/wsgi.py new file mode 100644 index 0000000..fd6d782 --- /dev/null +++ b/example/example/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for example project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings") + +application = get_wsgi_application() diff --git a/example/manage.py b/example/manage.py new file mode 100755 index 0000000..2605e37 --- /dev/null +++ b/example/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/example/requirements.txt b/example/requirements.txt new file mode 100644 index 0000000..bc331ce --- /dev/null +++ b/example/requirements.txt @@ -0,0 +1,5 @@ +# Your app requirements. +-r ../requirements_test.txt + +# Your app in editable mode. +-e ../ diff --git a/example/templates/django_cryptolock/base.html b/example/templates/django_cryptolock/base.html new file mode 100644 index 0000000..c70e9be --- /dev/null +++ b/example/templates/django_cryptolock/base.html @@ -0,0 +1,88 @@ +{% load staticfiles i18n %} + + + + + {% block title %}Django-Cryptolock{% endblock title %} + + + + + + + + {% block css %} + + + + + + {% endblock %} + + + + +
+ +
+ +
+ + {% if messages %} + {% for message in messages %} +
{{ message }}
+ {% endfor %} + {% endif %} + + {% block content %} +
+

Use this document as a way to quick start any new project.

+

The current template is loaded from + django-cryptolock/example/templates/base.html.

+

Whenever you overwrite the contents of django-cryptolock/django_cryptolock/urls.py with your + own content, you should see it here.

+
+ {% endblock content %} + +
+ +{% block modal %}{% endblock modal %} + + + +{% block javascript %} + + + + + + + + + + + +{% endblock javascript %} + + + diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..8c5be8a --- /dev/null +++ b/manage.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, absolute_import + +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings") + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0166d95 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +django-model-utils>=2.0 +# Additional requirements go here diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..d45b257 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,3 @@ +bumpversion==0.5.3 +wheel==0.30.0 +django-model-utils>=2.0 diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 0000000..e77ff30 --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1,8 @@ +coverage==4.4.1 +mock>=1.0.1 +flake8>=2.1.0 +tox>=1.7.0 +codecov>=2.0.0 +django-model-utils>=2.0 + +# Additional test requirements go here diff --git a/runtests.py b/runtests.py new file mode 100644 index 0000000..a68cf32 --- /dev/null +++ b/runtests.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 +from __future__ import unicode_literals, absolute_import + +import os +import sys + +import django +from django.conf import settings +from django.test.utils import get_runner + + +def run_tests(*test_args): + if not test_args: + test_args = ['tests'] + + os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' + django.setup() + TestRunner = get_runner(settings) + test_runner = TestRunner() + failures = test_runner.run_tests(test_args) + sys.exit(bool(failures)) + + +if __name__ == '__main__': + run_tests(*sys.argv[1:]) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..477d5fa --- /dev/null +++ b/setup.cfg @@ -0,0 +1,22 @@ +[bumpversion] +current_version = 0.0.1 +commit = True +tag = True + +[bumpversion:file:setup.py] + +[bumpversion:file:django_cryptolock/__init__.py] + +[wheel] +universal = 1 + +[flake8] +ignore = D203 +exclude = + django_cryptolock/migrations, + .git, + .tox, + docs/conf.py, + build, + dist +max-line-length = 119 diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..a78c57e --- /dev/null +++ b/setup.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import os +import re +import sys + +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + + +def get_version(*file_paths): + """Retrieves the version from django_cryptolock/__init__.py""" + filename = os.path.join(os.path.dirname(__file__), *file_paths) + version_file = open(filename).read() + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", + version_file, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError('Unable to find version string.') + + +version = get_version("django_cryptolock", "__init__.py") + + +if sys.argv[-1] == 'publish': + try: + import wheel + print("Wheel version: ", wheel.__version__) + except ImportError: + print('Wheel library missing. Please run "pip install wheel"') + sys.exit() + os.system('python setup.py sdist upload') + os.system('python setup.py bdist_wheel upload') + sys.exit() + +if sys.argv[-1] == 'tag': + print("Tagging the version on git:") + os.system("git tag -a %s -m 'version %s'" % (version, version)) + os.system("git push --tags") + sys.exit() + +readme = open('README.rst').read() +history = open('HISTORY.rst').read().replace('.. :changelog:', '') + +setup( + name='django-cryptolock', + version=version, + description="""Django authentication using cryptocurrency wallets""", + long_description=readme + '\n\n' + history, + author='Gonçalo Valério', + author_email='gon@ovalerio.net', + url='https://github.com/dethos/django-cryptolock', + packages=[ + 'django_cryptolock', + ], + include_package_data=True, + install_requires=["django-model-utils>=2.0",], + license="MIT", + zip_safe=False, + keywords='django-cryptolock', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Framework :: Django :: 2.0', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Natural Language :: English', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + ], +) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/settings.py b/tests/settings.py new file mode 100644 index 0000000..102c0df --- /dev/null +++ b/tests/settings.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 +from __future__ import unicode_literals, absolute_import + +import django + +DEBUG = True +USE_TZ = True + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = "!z^^097u*@)yq#w1n14m%uh-l67#h&uft9p+m%$$(0y(s%-q7o" + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": ":memory:", + } +} + +ROOT_URLCONF = "tests.urls" + +INSTALLED_APPS = [ + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sites", + "django_cryptolock", +] + +SITE_ID = 1 + +if django.VERSION >= (1, 10): + MIDDLEWARE = () +else: + MIDDLEWARE_CLASSES = () diff --git a/tests/test_models.py b/tests/test_models.py new file mode 100644 index 0000000..4de7a99 --- /dev/null +++ b/tests/test_models.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +test_django-cryptolock +------------ + +Tests for `django-cryptolock` models module. +""" + +from django.test import TestCase + +from django_cryptolock import models + + +class TestDjango_cryptolock(TestCase): + + def setUp(self): + pass + + def test_something(self): + pass + + def tearDown(self): + pass diff --git a/tests/urls.py b/tests/urls.py new file mode 100644 index 0000000..e49b024 --- /dev/null +++ b/tests/urls.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, absolute_import + +from django.conf.urls import url, include + + +urlpatterns = [ + url(r'^', include('django_cryptolock.urls', namespace='django_cryptolock')), +] diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..6c01914 --- /dev/null +++ b/tox.ini @@ -0,0 +1,16 @@ +[tox] +envlist = + {py35,py36,py37}-django-20 + +[testenv] +setenv = + PYTHONPATH = {toxinidir}:{toxinidir}/django_cryptolock +commands = coverage run --source django_cryptolock runtests.py +deps = + django-20: Django>=2.0,<2.1 + -r{toxinidir}/requirements_test.txt +basepython = + py37: python3.7 + py36: python3.6 + py35: python3.5 + py27: python2.7