Nisha Patel
Problem
I have created a custom Django command, where I have imported models as shown below
I have used the full path to models.py as you can see in the above imported module list
from Employeetable.EVENTS.models import Event, EmailTemplate
I have used the IDE to give the suggestion on the selection of path, yet I am getting below error
As per the rule I have placed my custom command file send_birthday_emails inside app/management/commands.
I have attached the screenshot for your reference to show the exact path of the file.
This is the location from where I an running the below custom command
python manage.py send_birthday_emails
Solution
I tried to replicate your directory in my own system.
If I am using absolute import from the project directory I get the same error
But if I am importing it from the app level like below :
from EVENTS.models import Event, EmailTemplate
It's working fine for me, give it a try once.
Answered by: >madara_was_right
Credit: >StackOverflow
Blog Links:
>Sorting the restframework in Django
>Ways to access instances of models in view in order to save both forms at once in Django
>What makes index.html have such kind of name in Django?
>Fix Module Not Found during Deployment- Django
>Creating a Django with existing directories, files, etc.?
>How to Read a CSV file with PHP using cURL?