--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/64c28c86-41d4-4242-a8bf-05862a4b18fbn%40googlegroups.com.
Good... it's just a path issue.
Instead of doing 'from . import views', try this: 'from {app_name} import views'.
In your case, you have an app named 'land', so it would look something like this:
'from land import views'.
You need to specify the app name because of the directory structure. When you use 'from . import', you're telling Django to import something from the current directory, which in your case is 'homeland'. However, 'homeland' typically doesn't contain an app directory.
And please make sure you actually created app with manage.py startapp {app_name} and included the app in your settings.py:
Thanks for the tip,what can be the problem if Django is not importing a function from the app directory ie from land import views,the function in views is pen, error traceback states there is no pen function in views.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/da36e2df-a452-43e6-b02d-0f7621aaed65n%40googlegroups.com.
Use like this
path('pen/',views.land,name='pen'),
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJt9CbgRWLxuLN4BsLhSSo1t4frUEkrSdhY91DbZ7aNQSGYt_g%40mail.gmail.com.
Is views.py in the same folder of urls.py or is views.py in the parent folder of urls folder?
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJt9CbgRWLxuLN4BsLhSSo1t4frUEkrSdhY91DbZ7aNQSGYt_g%40mail.gmail.com.
Send the screenshot of folder structure, in which file you are importing and how you are importing?
--
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL1qS4cURZGd1G%3D_XaODgqjvWVmCBdSnXyxD42n2ekmrc0nsvg%40mail.gmail.com.
There's no file named views.py in that directory
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL1qS4dto%2BDDAjdy3_4RZQ-i1AMvfR9raPCBW2izeoWYV1pWrQ%40mail.gmail.com.