2👍
It seems like your project name is PyDemo
and the name of the module is accounts
. So try using
from accounts.views import my_view
You may find an error (underlined by red mark) that is because of your IDE so ignore it and migrate it. It will work
0👍
For anyone else with this issue who is migrating from Python 2 to 3 it seems to be because Python 3 is more discerning about where to find modules. @Ranjith Singhu’s comment sent me in the right direction. In my case I had to change:
Python 2:
from views import MyView
Python 3 (also fine in 2):
from project_name.views import MyView
- [Answered ]-Schedule Django Celery periodic tasks to run from time to other time
- [Answered ]-Google SDK gcloud crashed (UnicodeDecodeError): 'utf8' codec can't decode byte 0xf8 in position 29: invalid start byte
- [Answered ]-How to test a Django view which has transaction.atomic(using=myDb)?
- [Answered ]-Save uploaded files in subfolder depending on request
- [Answered ]-Django conditional view processing decorator adds stale Etag
Source:stackexchange.com