What Python packages am I missing? - python

I'm trying to get my local Windows 10 PC up and running with my Django application. I'm a novice at Python and Django. My app was written by another developer who's been very helpful and has limited availability. I also want to sort it out myself for learning purposes.
I downloaded my code from Bitbucket and loaded all of the packages in the base.txt and development.txt files onto my Windows 10 PC. I keep getting several errors when trying to run the server.
App is using in the following:
Python 3.61
Django 1.11.3
base.txt file:
boto3==1.4.7
celery==4.1.0
click==6.7
dateutils==0.6.6
Django==1.11.3
django-anymail==0.11.1
django-cors-headers==2.1.0
django-countries==5.0
django-filter==1.0.4
django-solo==1.1.3
django-storages==1.6.5
djangorestframework==3.6.3
djoser==0.6.0
kombu==4.1.0
mysqlclient==1.3.10
Pillow==4.3.0
python-dotenv==0.6.4
python-magic==0.4.13
pytz==2017.2
redis==2.10.6
uWSGI==2.0.15
xlrd==1.2.0
I don't get any errors loading the packages; however, when I run the server I get this screenful of error messages:
(venv) C:\Users\romph\dev\EWO-DEV\backend>python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000002A64687E0D0>
Traceback (most recent call last):
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper fn(*args, **kwargs)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run self.check(display_num_errors=True)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\management\base.py", line 359, in check include_deployment_checks=include_deployment_checks,
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\management\base.py", line 346, in _run_checks return checks.run_checks(**kwargs)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config return check_resolver(resolver)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver return check_method()
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\urls\resolvers.py", line 254, in check for pattern in self.url_patterns:
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module return import_module(self.urlconf_name)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "C:\Users\romph\dev\EWO-DEV\backend\ewo\urls.py", line 51, in <module> url(r"^api/", include("apps.accounts.urls", namespace="accounts")),
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\conf\urls\__init__.py", line 50, in include urlconf_module = import_module(urlconf_module)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "C:\Users\romph\dev\EWO-DEV\backend\apps\accounts\urls.py", line 5, in <module> from . import views
File "C:\Users\romph\dev\EWO-DEV\backend\apps\accounts\views.py", line 23, in <module> from .serializers import (
File "C:\Users\romph\dev\EWO-DEV\backend\apps\accounts\serializers.py", line 6, in <module> from apps.company.serializers import EmployeeSerializer
File "C:\Users\romph\dev\EWO-DEV\backend\apps\company\serializers.py", line 18, in <module> from apps.common.serializers import YesOrNoField
File "C:\Users\romph\dev\EWO-DEV\backend\apps\common\serializers.py", line 10, in <module> from .validators import CSVValidator, DocumentValidator
File "C:\Users\romph\dev\EWO-DEV\backend\apps\common\validators.py", line 6, in <module> import magic
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\magic\__init__.py", line 209, in <module> libmagic = loader.load_lib()
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\magic\loader.py", line 49, in load_lib raise ImportError('failed to find libmagic. Check your installation')

That last line gives a pretty good clue.
Visit https://pypi.org/project/python-magic/
and follow the steps for Windows.
Windows
You'll need DLLs for libmagic. #julian-r maintains a pypi
package with the DLLs ...
You likely need to
pip install python-magic-bin
The requirements may have been specific to another os.

Related

Heroku. ImportError: cannot import name 'ugettext_lazy'. How can I edit file into Heroku container?

I have deployed my project to Heroku. But I got "Internal server error"
"ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/app/.heroku/python/lib/python3.8/site-packages/django/utils/translation/init.py)"
Yes, I know that I should write "gettext_lazy" instead. But I can't find this file in my project. Can I edit code in Heroku container? How?
I got this error only after deploy.
I don't understand where this file is situated.
Help me, please.
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 373, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 417, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 90, in wrapped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 75, in handle
self.check(databases=[database])
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 438, in check
all_issues = checks.run_checks(
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/checks/registry.py", line 77, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/app/.heroku/python/lib/python3.8/site-packages/django/urls/resolvers.py", line 446, in check
for pattern in self.url_patterns:
File "/app/.heroku/python/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/app/.heroku/python/lib/python3.8/site-packages/django/urls/resolvers.py", line 632, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/app/.heroku/python/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/app/.heroku/python/lib/python3.8/site-packages/django/urls/resolvers.py", line 625, in urlconf_module
return import_module(self.urlconf_name)
File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/Bianka/urls.py", line 28, in <module>
path('', include('bianka_site.urls')),
File "/app/.heroku/python/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/bianka_site/urls.py", line 2, in <module>
from . import views
File "/app/bianka_site/views.py", line 8, in <module>
from .forms import CommentForm, LikeForm
File "/app/bianka_site/forms.py", line 3, in <module>
from snowpenguin.django.recaptcha3.fields import ReCaptchaField
File "/app/.heroku/python/lib/python3.8/site-packages/snowpenguin/django/recaptcha3/fields.py", line 7, in <module>
from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/app/.heroku/python/lib/python3.8/site-packages/django/utils/translation/__init__.py)
my requirements.txt
asgiref==3.4.1
backports.zoneinfo==0.2.1
certifi==2021.10.8
charset-normalizer==2.0.10
dj-database-url==0.5.0
Django==4.0
django-ckeditor==6.2.0
django-js-asset==1.2.2
django-modeltranslation==0.17.3
django-recaptcha3==0.4.0
fontawesomefree==6.0.0
gunicorn==20.1.0
idna==3.3
Pillow==8.4.0
psycopg2==2.9.3
requests==2.27.1
six==1.16.0
sqlparse==0.4.2
tzdata==2021.5
urllib3==1.26.7
whitenoise==6.0.0

When I run my Django project developed on Windows on Ubuntu it gives errors as below, even after creating virtualenv and configured properly

Here is the errors
I have installed and created virtualenv as same like the one on Windows and replaced it on Ubuntu with that new one. I could activate the virtual but when I do python3 manage.py runserver it gives error as like below. If someone help, it will be grateful.
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 61, in execute
super().execute(*args, **options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 96, in handle
self.run(**options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 105, in run
self.inner_run(None, **options)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/management/base.py", line 423, in check
databases=databases,
File "/home/pema/.local/lib/python3.6/site-packages/django/core/checks/registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/pema/.local/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/pema/.local/lib/python3.6/site-packages/django/urls/resolvers.py", line 416, in check
for pattern in self.url_patterns:
File "/home/pema/.local/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/pema/.local/lib/python3.6/site-packages/django/urls/resolvers.py", line 602, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/pema/.local/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/pema/.local/lib/python3.6/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/pema/Desktop/Django/devsearch/devsearch/urls.py", line 9, in <module>
path("", include("users.urls"))
File "/home/pema/.local/lib/python3.6/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/pema/Desktop/Django/devsearch/users/urls.py", line 3, in <module>
from. import views
File "/home/pema/Desktop/Django/devsearch/users/views.py", line 8, in <module>
from .forms import CustomUserCreationForm, ProfileForm, SkillForm
File "/home/pema/Desktop/Django/devsearch/users/forms.py", line 1, in <module>
from dataclasses import fields
ModuleNotFoundError: No module named 'dataclasses'
Data classes were introduced in Python 3.7. You are running Python 3.6.

Django, Can not import urls from django.conf.urls

I am working on django restframework project. I build it and it was working well but then I tried makemigrations and I got following error. Please help me.
File "/code/eventful/manage.py", line 22, in <module>
main()
File "/code/eventful/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 373, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 412, in execute
self.check()
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 438, in check
all_issues = checks.run_checks(
File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 77, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 446, in check
for pattern in self.url_patterns:
File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 632, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 625, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/code/eventful/eventful/urls.py", line 25, in <module>
path('api/rest-auth/', include('rest_auth.urls')),
File "/usr/local/lib/python3.10/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/local/lib/python3.10/site-packages/rest_auth/urls.py", line 1, in <module>
from django.conf.urls import url
ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/local/lib/python3.10/site-packages/django/conf/urls/__init__.py)
I tried makemigrations for my django project but I have got that error and I do not have any idea about this error. Can anybody help me. Please!
the url was removed in Django 4.0
Look at the release notes here:
https://docs.djangoproject.com/pl/4.0/releases/4.0/#features-removed-in-4-0
django.conf.urls.url() is removed
As of django-4.0, the url function is removed. Indeed, in the release notes we see:
django.conf.urls.url() is removed.
You thus are using rest_auth which is incompatible with the Django version. The django-rest-auth project [GitHub] still uses the url(…) function in the urls.py [GitHub].
You thus should downgrade Django (to django-3.2) to work with the django-rest-auth, or you should wait until the django-rest-auth makes a release that is compatible with django-4.0.

Getting error when Django startup with runserver command

I have an django app that include sklearn, pandas and numpy libraries. I can run it without virtualenv however when I run it inside virtualenv I get his error. I am using Python3.8 on Ubuntu. I just want to use virtualenv to manage my packages easily. I re-installed packages in the virtualenv with PyCharm. My error include references to the joblib library too.
I cannot find any solution:
Matching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check
all_issues = checks.run_checks(
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 408, in check
for pattern in self.url_patterns:
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 589, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 582, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/suat/Belgeler/github/turnusol/turnusolwebproject/urls.py", line 31, in <module>
path('factomat', include('factomat.urls')),
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/suat/Belgeler/github/turnusol/factomat/urls.py", line 2, in <module>
from . import views
File "/home/suat/Belgeler/github/turnusol/factomat/views.py", line 13, in <module>
from sklearn.externals import joblib
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/__init__.py", line 119, in <module>
from .parallel import Parallel
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/parallel.py", line 28, in <module>
from ._parallel_backends import (FallbackToBackend, MultiprocessingBackend,
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/_parallel_backends.py", line 22, in <module>
from .executor import get_memmapping_executor
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/executor.py", line 14, in <module>
from .externals.loky.reusable_executor import get_reusable_executor
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/externals/loky/__init__.py", line 12, in <module>
from .backend.reduction import set_loky_pickler
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/externals/loky/backend/reduction.py", line 125, in <module>
from sklearn.externals.joblib.externals import cloudpickle # noqa: F401
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/__init__.py", line 3, in <module>
from .cloudpickle import *
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py", line 167, in <module>
_cell_set_template_code = _make_cell_set_template_code()
File "/home/suat/Belgeler/github/turnusol/venv/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py", line 148, in _make_cell_set_template_code
return types.CodeType(
TypeError: an integer is required (got type bytes)
That looks like you may have run into a known issue with Python 3.8 and cloudpickle following changes in PEP 570.
It's not clear from the cloudpickle Github repo whether it supports Python 3.8 yet, so a potential fix may be to use Python 3.7 in the virtualenv instead.

ImportError: No module named 'posts.urls'

I am new to Django and started making my first Django app using django official tutorial from https://docs.djangoproject.com/en/2.0/intro/tutorial01/.
I have installed python3.5.2 and pip 9.0.1, using Ubuntu 16.04, Django version is 2.0.
my urls.py file has following code
from django.contrib import admin
from django.urls import path
from django.conf.urls import url, include
urlpatterns = [
path('posts/', include('posts.urls')),
path('admin/', admin.site.urls),
]
If there is anything you can help me work this out. below is the error i am getting after running command -
python manage.py runserver
here is the error i am getting
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fe20fe92d08>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 120, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 364, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 351, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/registry.py", line 73, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/urls/resolvers.py", line 536, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/urls/resolvers.py", line 529, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/var/www/html/django-projects/djangoblog/djangoblog/urls.py", line 21, in <module>
path('posts/', include('posts.urls')),
File "/usr/local/lib/python3.5/dist-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'posts.urls'
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f8390058bf8>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 120, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 364, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 351, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/registry.py", line 73, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/usr/local/lib/python3.5/dist-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/urls/resolvers.py", line 536, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/urls/resolvers.py", line 529, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/var/www/html/django-projects/djangoblog/djangoblog/urls.py", line 21, in <module>
path('posts/', include('posts.urls')),
File "/usr/local/lib/python3.5/dist-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
IF there is anything you can help me with. I have already tried every other solution existed on internet yet.
/var/www/html/django-projects/djangoblog/ must be your project root.
If you use an IDE like PyCharm, right click to the "djangoblog"-folder -> Mark Directory as -> Source Root
If you use a shell to run Django:
cd /var/www/html/django-projects/djangoblog/
./manage.py runserver
Hope this works for you.

Categories

Resources