Skip to content

Commit d60e747

Browse files
committed
packaged app
1 parent aa738fe commit d60e747

File tree

16 files changed

+177
-49
lines changed

16 files changed

+177
-49
lines changed

MANIFEST.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include LICENSE
2+
include MANIFEST.in
3+
include README.rst
4+
recursive-include docs *
5+
recursive-include graph_auth/templates *
6+
7+
recursive-exclude * __pycache__
8+
recursive-exclude * *.py[co]

README.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
=====
2+
Polls
3+
=====
4+
5+
Polls is a Django app to conduct web-based polls. For each question,
6+
visitors can choose between a fixed number of answers.
7+
8+
Detailed documentation is in the "docs" directory.
9+
10+
Quick start
11+
-----------
12+
13+
1. Add "polls" to your INSTALLED_APPS setting like this::
14+
15+
INSTALLED_APPS = [
16+
...
17+
'polls',
18+
]
19+
20+
2. Include the polls URLconf in your project urls.py like this::
21+
22+
path('polls/', include('polls.urls')),
23+
24+
3. Run ``python manage.py migrate`` to create the polls models.
25+
26+
4. Start the development server and visit http://127.0.0.1:8000/admin/
27+
to create a poll (you'll need the Admin app enabled).
28+
29+
5. Visit http://127.0.0.1:8000/polls/ to participate in the poll.

ReadMe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ This a replacement for [Django GraphQL Auth](https://github.com/PedroBern/django
99
- [ ] Add a Notify Admin Aysnc function that sends emails to admins when Exceptions occur
1010
- [ ] Write Tests
1111
- [ ] Package the app for Pypi
12+
13+
14+
## Resources
15+
- [Reusing Django Apps](https://docs.djangoproject.com/en/4.1/intro/reusable-apps/)
16+
- [Installing Using Pip](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Graph Auth
2+

graph_auth/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "0.3.16"
1+
__version__ = "0.1.0"
22

33
default_app_config = "graph_auth.apps.GraphQLAuthConfig"

graph_auth/graphql/base.py renamed to graph_auth/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import graphene
22

3-
from ..type import ExpectedErrorType
3+
from .type import ExpectedErrorType
44

55
# TODO: if for custom was here
66
OutputErrorType = ExpectedErrorType

graph_auth/graphql/inputs.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

graph_auth/migrations/0001_initial.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Generated by Django 4.1.7 on 2023-03-02 01:20
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
initial = True
11+
12+
dependencies = [
13+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14+
]
15+
16+
operations = [
17+
migrations.CreateModel(
18+
name='UserStatus',
19+
fields=[
20+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21+
('verified', models.BooleanField(default=False)),
22+
('archived', models.BooleanField(default=False)),
23+
('secondary_email', models.EmailField(blank=True, max_length=254, null=True)),
24+
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='status', to=settings.AUTH_USER_MODEL)),
25+
],
26+
),
27+
]

graph_auth/migrations/__init__.py

Whitespace-only changes.

graph_auth/schema.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .constants import Messages, TokenAction
1818
from .exceptions import (EmailAlreadyInUse, TokenScopeError,
1919
UserAlreadyVerified, UserNotVerified)
20-
from .graphql.base import (BaseRegister, PasswordResetBase,
20+
from .base import (BaseRegister, PasswordResetBase,
2121
ResendActivationEmailBase,
2222
SendPasswordResetEmailBase, VerifyAccountBase)
2323
from .models import UserStatus
@@ -138,6 +138,7 @@ def perform_mutation(cls, root, info, **kwargs):
138138
# ],
139139
# countdown=10,
140140
# )
141+
print("Exception details: %s" % str(e))
141142
return cls(
142143
success=False,
143144
errors=[Messages.SERVER_ERROR],
@@ -186,6 +187,7 @@ def perform_mutation(cls, root, info, **kwargs):
186187
# ],
187188
# countdown=10,
188189
# )
190+
print("Exception details: %s" % str(e))
189191
return cls(
190192
success=False,
191193
errors=[Messages.SERVER_ERROR],
@@ -231,6 +233,7 @@ def perform_mutation(cls, root, info, **kwargs):
231233
# ],
232234
# countdown=10,
233235
# )
236+
print("Exception details: %s" % str(e))
234237
return cls(
235238
success=False,
236239
errors=[Messages.SERVER_ERROR],
@@ -283,6 +286,7 @@ def perform_mutation(cls, root, info, **kwargs):
283286
# ],
284287
# countdown=10,
285288
# )
289+
print("Exception details: %s" % str(e))
286290
return cls(
287291
success=False,
288292
errors=[Messages.SERVER_ERROR],
@@ -336,6 +340,7 @@ def perform_mutation(cls, root, info, **kwargs):
336340
# ],
337341
# countdown=10,
338342
# )
343+
print("Exception details: %s" % str(e))
339344
return cls(
340345
success=False,
341346
errors=[Messages.SERVER_ERROR],

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ['setuptools>=40.8.0', 'wheel']
3+
build-backend = 'setuptools.build_meta:__legacy__'

requirements/dev.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-r base.txt
2+
3+
# linting
4+
black==22.12.0
5+
flake8==6.0.0
6+
isort==5.11.4
7+

setup.cfg

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[metadata]
2+
name = django-graph-auth
3+
version = 0.1
4+
description = A Django GraphQL App for Authentication
5+
long_description = file: README.rst
6+
url = https://github.com/itzomen/django-graph-auth
7+
author = Peng Boris Akebuon
8+
author_email = [email protected]
9+
license = MIT
10+
classifiers =
11+
Environment :: Web Environment
12+
Framework :: Django
13+
Framework :: Django :: 4.1 # Replace "X.Y" as appropriate
14+
Intended Audience :: Developers
15+
License :: OSI Approved :: BSD License
16+
Operating System :: OS Independent
17+
Programming Language :: Python
18+
Programming Language :: Python :: 3
19+
Programming Language :: Python :: 3 :: Only
20+
Programming Language :: Python :: 3.8
21+
Programming Language :: Python :: 3.9
22+
Topic :: Internet :: WWW/HTTP
23+
Topic :: Internet :: WWW/HTTP :: Dynamic Content
24+
25+
[options]
26+
include_package_data = true
27+
packages = find:
28+
python_requires = >=3.8
29+
install_requires =
30+
Django >= 3.0 # Replace "X.Y" as appropriate
31+
32+
[aliases]
33+
test=pytest
34+
35+
[bdist_wheel]
36+
universal=1
37+
38+
[coverage:run]
39+
omit = */tests/*
40+
41+
[isort]
42+
known_first_party=graph_auth,
43+
multi_line_output=3
44+
include_trailing_comma=True
45+
force_grid_wrap=0
46+
use_parentheses=True
47+
line_length=88
48+
49+
[flake8]
50+
exclude = setup.py,docs/*,testproject/*,tests,quickstart/
51+
max-line-length = 88
52+
extend-ignore = E203
53+
ignore = apps.py F401, utils.py W503

setup.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,32 @@ def get_version(package):
2121
"coveralls",
2222
]
2323

24-
dev_requires = ["black==19.3b0", "flake8==3.7.7"] + tests_require
24+
dev_requires = ["black==22.12.0", "flake8==6.0.0"] + tests_require
2525

2626
setup(
27-
name="django-graphql-auth",
28-
version=get_version("graphql_auth"),
27+
name="django-graph-auth",
28+
version=get_version("graph_auth"),
2929
license="MIT",
30-
description="Graphql and relay authentication with Graphene for Django.",
30+
description="Graphql and relay (coming soon) authentication with Graphene for Django.",
3131
long_description=open("README.rst").read(),
3232
long_description_content_type="text/x-rst",
33-
author="pedrobern",
34-
author_email="pedrobermoreira@gmail.com",
35-
maintainer="pedrobern",
36-
url="https://github.com/PedroBern/django-graphql-auth",
33+
author="itzomen",
34+
author_email="peng@traleor.com",
35+
maintainer="itzomen",
36+
url="https://github.com/itzomen/django-graph-auth",
3737
project_urls=OrderedDict(
3838
(
39-
("Documentation", "https://django-graphql-auth.readthedocs.io/en/latest/"),
40-
("Issues", "https://github.com/PedroBern/django-graphql-auth/issues"),
39+
("Documentation", "https://github.com/itzomen/django-graph-auth"),
40+
("Issues", "https://github.com/itzomen/django-graph-auth/issues"),
4141
)
4242
),
4343
packages=find_packages(exclude=["tests*"]),
4444
install_requires=[
45-
"Django>=2.2.0",
46-
"django-graphql-jwt>=0.3.2,<0.4.0",
47-
"django-filter>=2.2.0",
48-
"graphene_django>=2.1.8",
49-
"graphene>=2.1.8",
45+
"Django>=4.1.7",
46+
"django-graphql-jwt>=0.3.4,<0.4.0",
47+
"django-filter>=22.1",
48+
"graphene_django>=3.0.0",
49+
"graphene>=3.2.1",
5050
],
5151
tests_require=tests_require,
5252
classifiers=[
@@ -56,12 +56,12 @@ def get_version(package):
5656
"License :: OSI Approved :: MIT License",
5757
"Operating System :: OS Independent",
5858
"Programming Language :: Python",
59-
"Programming Language :: Python :: 3.6",
60-
"Programming Language :: Python :: 3.7",
6159
"Programming Language :: Python :: 3.8",
60+
"Programming Language :: Python :: 3.9",
61+
"Programming Language :: Python :: 3.10",
6262
"Framework :: Django",
63-
"Framework :: Django :: 2.2",
6463
"Framework :: Django :: 3.0",
64+
"Framework :: Django :: 4.1",
6565
],
6666
keywords="api graphql rest relay graphene auth",
6767
zip_safe=False,

testproject/settings.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
'django.contrib.auth',
3636
'django.contrib.contenttypes',
3737
'django.contrib.sessions',
38+
"django.contrib.sites",
3839
'django.contrib.messages',
3940
'django.contrib.staticfiles',
41+
4042

4143
#
4244
"graphene_django",
@@ -138,25 +140,27 @@
138140
}
139141

140142
AUTHENTICATION_BACKENDS = [
141-
"graphql_auth.backends.GraphQLAuthBackend",
143+
"graphql_jwt.backends.JSONWebTokenBackend",
144+
# TODO: Maybe create custom backend
145+
# "graph_auth.backends.GraphQLAuthBackend",
142146
"django.contrib.auth.backends.ModelBackend",
143147
]
144148

145149
GRAPHQL_JWT = {
146150
"JWT_VERIFY_EXPIRATION": True,
147151
"JWT_LONG_RUNNING_REFRESH_TOKEN": True,
148-
"JWT_ALLOW_ANY_CLASSES": [
149-
"graphql_auth.mutations.Register",
150-
"graphql_auth.mutations.VerifyAccount",
151-
"graphql_auth.mutations.ResendActivationEmail",
152-
"graphql_auth.mutations.SendPasswordResetEmail",
153-
"graphql_auth.mutations.PasswordReset",
154-
"graphql_auth.mutations.ObtainJSONWebToken",
155-
"graphql_auth.mutations.VerifyToken",
156-
"graphql_auth.mutations.RefreshToken",
157-
"graphql_auth.mutations.RevokeToken",
158-
"graphql_auth.mutations.VerifySecondaryEmail",
159-
],
152+
# "JWT_ALLOW_ANY_CLASSES": [
153+
# "graph_auth.mutations.Register",
154+
# "graph_auth.mutations.VerifyAccount",
155+
# "graph_auth.mutations.ResendActivationEmail",
156+
# "graph_auth.mutations.SendPasswordResetEmail",
157+
# "graph_auth.mutations.PasswordReset",
158+
# "graph_auth.mutations.ObtainJSONWebToken",
159+
# "graph_auth.mutations.VerifyToken",
160+
# "graph_auth.mutations.RefreshToken",
161+
# "graph_auth.mutations.RevokeToken",
162+
# "graph_auth.mutations.VerifySecondaryEmail",
163+
# ],
160164
}
161165

162166
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

tests/___init___.py

Whitespace-only changes.

0 commit comments

Comments
 (0)