Creation des views.py
bonsoir,
lorsque je relance le serveur , pycharm affiche l'erreur suivante, je ne comprends pas comment la résoudre.
Merci pour votre aide
(.env) (base) yann_1@iMac src % python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/core/management/base.py", line 392, in check
all_issues = checks.run_checks(
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/core/checks/registry.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/urls/resolvers.py", line 408, in check
for pattern in self.url_patterns:
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/urls/resolvers.py", line 589, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/urls/resolvers.py", line 582, in urlconf_module
return import_module(self.urlconf_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/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 "/Users/yann_1/DocBlog/src/DocBlog/urls.py", line 23, in <module>
path('blog/', include("blog.urls")),
File "/Users/yann_1/DocBlog/.env/lib/python3.10/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/Library/Frameworks/Python.framework/Versions/3.10/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 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'blog.urls'
oui tout à fait j'ai suivi le déroulé du cours!
Bonjour Pierre_André, je suis bloqué un peu plus loin maintenant, avec la partie sur les views et les articles qui ne s'affichent pas sur la page internet. Ou se trouve le drive que je puisse partager mes fichiers?
Merci
Bonjour, je vous joins les captures d'écran.
Je n'arrive pas à afficher les différents articles sur la page web.
voici ton drive perso https://drive.google.com/drive/u/1/folders/1IFmhwBq48NuuZXhyaByEKCtrqPKmZ5yD
tu peux mettre ton code ici .
Je vois dans tes captures qu'il y a un problème. Tu as un template html par article ? Normalement tu n'as qu'un template html et c'est le contenu qui est mis à jour dynamiquement. Et aussi le numéro d'article est plutôt de type int et non str. J'essaye de regarder ton code dans la journée ou au plus tard demain.
Inscris-toi
(c'est gratuit !)
Tu dois créer un compte pour participer aux discussions.
Créer un compte