Bonjour,
Je travaille avec Django, et je ne parviens pas à importer un fichier d'un module, alors que ceux voisins sont accessibles :
1 2 3 4 5 6 7 | $ ls projects/ admin.py apps.py forms.py __init__.py migrations models.py __pycache__ static templates tests.py urls.py views $ ls projects/views/ account.py correspondent.py __init__.py manager.py __pycache__ $ ./manage.py runserver [...] AttributeError: module 'projects.views' has no attribute 'account' |
L'erreur provient du fichier projects/urls.py
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | from django.conf.urls import url from . import views app_name = 'projects' urlpatterns = [ url(r'^$', views.account.index, name='index'), url(r'^(?P<pk>[0-9]+)/(?P<slug>[-_\w]*)$', views.correspondent.edit_project, name='edit'), url(r'^previsualiser/projet/(?P<pk>[0-9]+)/(?P<slug>[-_\w]*)$', views.correspondent.preview_project, name='preview'), url(r'^editer/progression/(?P<project_pk>[0-9]+)$', views.correspondent.set_progression, name='set_progression'), url(r'^supprimer/section/(?P<pk>[0-9]+)$', views.correspondent.delete_section, name='delete_section'), url(r'^ajouter/image/(?P<project_pk>[0-9]+)$', views.correspondent.add_image, name='add_image'), url(r'^ajouter/video/(?P<project_pk>[0-9]+)$', views.correspondent.add_video, name='add_video'), url(r'^ajouter/section/(?P<project_pk>[0-9]+)$', views.correspondent.add_section, name='add_section'), # Manager url(r'^valider$', views.manager.validate, name='validate'), url(r'^valider/projet/(?P<pk>[0-9]+)$', views.manager.validate_project, name='validate_project'), url(r'^valider/progressions$', views.manager.validate_progressions, name='validate_progressions'), url(r'^valider/images$', views.manager.validate_images, name='validate_images'), url(r'^valider/videos$', views.manager.validate_videos, name='validate_videos'), url(r'^creer$', views.manager.create, name='create'), url(r'^archiver/(?P<pk>[0-9]+)$', views.manager.archive, name='archive'), # Accounts url(r'^connexion$', views.account.login, name='login'), url(r'^deconnexion$', views.account.logout, name='logout'), ] |
Quand je commente la ligne 7, c'est la 24 qui fait gueuler.
Merci.
+0
-0