Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'Paste' is not defined #35

Open
leybodv opened this issue Sep 9, 2023 · 0 comments
Open

NameError: name 'Paste' is not defined #35

leybodv opened this issue Sep 9, 2023 · 0 comments

Comments

@leybodv
Copy link

leybodv commented Sep 9, 2023

Following recipe in Chapter 3 from Designing a pastebin to the point where urls are configured and http://127.0.0.1/pastebin is suggested to be visited, produces error in django server:

Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/usr/lib/python3/dist-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 419, in check
all_issues = checks.run_checks(
File "/usr/lib/python3/dist-packages/django/core/checks/registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/usr/lib/python3/dist-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/usr/lib/python3/dist-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 416, in check
for pattern in self.url_patterns:
File "/usr/lib/python3/dist-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 602, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/lib/python3/dist-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 595, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/d/nextcloud/programming/django/djen_project/djen_project/urls.py", line 21, in
path('pastebin/', include('pastebin.urls'))
File "/usr/lib/python3/dist-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/d/nextcloud/programming/django/djen_project/pastebin/urls.py", line 2, in
from .views import PasteCreate
File "/home/d/nextcloud/programming/django/djen_project/pastebin/views.py", line 3, in
class PasteCreate(CreateView):
File "/home/d/nextcloud/programming/django/djen_project/pastebin/views.py", line 4, in PasteCreate
model = Paste
NameError: name 'Paste' is not defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant