srijannnd / mango-jwt

JWT Authentication for Django Rest Framework and MongoDB
MIT License
1 stars 4 forks source link

after step 2 when adding th url of mongo-auth i had this error #3

Closed ninette98 closed 4 years ago

ninette98 commented 5 years ago

Exception in thread django-main-thread: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run self._target(*self._args, *self._kwargs) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(args, kwargs) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/core/management/base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/core/management/base.py", line 377, in _run_checks return checks.run_checks(kwargs) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces url_patterns = getattr(resolver, 'url_patterns', []) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/utils/functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 579, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/utils/functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 572, in urlconf_module return import_module(self.urlconf_name) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/project1/project1/urls.py", line 24, in path('mongo_auth/', include('mongo_auth.urls')), File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/django/urls/conf.py", line 34, in include urlconf_module = import_module(urlconf_module) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/mongo_auth/urls.py", line 2, in from mongo_auth import views File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/mongo_auth/views.py", line 2, in from mongo_auth.utils import create_unique_object_id, pwd_context File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/mongo_auth/utils.py", line 4, in from mongo_auth.db import jwt_secret, auth_collection File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/mongo_auth/db.py", line 15, in client = MongoClient(mongo_uri) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/pymongo/mongo_client.py", line 524, in init res = uri_parser.parse_uri(entity, port, warn=True) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/pymongo/uri_parser.py", line 391, in parse_uri nodes = split_hosts(hosts, default_port=default_port) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/pymongo/uri_parser.py", line 227, in split_hosts nodes.append(parse_host(entity, port)) File "/Users/mac/Desktop/smm/SmmS-App-kaou-22/backk/venv/lib/python3.7/site-packages/pymongo/uri_parser.py", line 122, in parse_host % (port,)) ValueError: Port must be an integer between 0 and 65535: some_db_port

srijannnd commented 4 years ago

Looks like you are trying yo connect to MongoDB Atlas. Don't include "db_port" if this is the case and use srv host in "db_host". Upgrade to the latest version and read the docs. They have been updated.